Property usedJSHeapSize in Chrome

After doing some research online, I found that the documentation on this topic is quite lacking. I am currently dealing with a significant memory leak in my code and have been using:

window.performance.memory.usedJSHeapSize 

However, it seems like the value remains stagnant at 10MB, which is not accurate when compared to the values shown either here:

chrome://memory-internals/

or when looking at the Timeline in devTools where there is a noticeable discrepancy. Has anyone else encountered a similar issue? Do I need to manually update these values (by running commands such as "update" or "measure")?

Further exploring this topic through: Information heap size it appears that this value increases by a specific increment. Is there a way to identify or adjust this increment? Based on my observations, the page initially has about 10MB of memory, which then grows to approximately 400MB after 30 minutes, ultimately causing the page to crash half an hour later... Any suggestions?

(The underlying cause of the memory leak within the code is a separate issue; please focus on helping me utilize this variable for testing purposes).

Answer №1

If you're curious about how memory information is handled on WebPlatform.org, there's a helpful section in their documentation that delves into the details:

To enhance security and protect against potential attacks, memory values are quantized to prevent exposure of private data. However, if Chrome is executed with the --enable-precise-memory-info flag, these values are not quantized.

For more insight, check out the following link:

By default, the displayed number is not fully accurate and only updates every 20 minutes. This might explain why your number appears static. On the other hand, enabling the flag results in precise real-time updates.

The detailed reasoning behind this approach can be found in the WebKit commit message:

A recent patch introduces an option for websites to access quantized and rate-limited memory information. By limiting data retrieval to every 20 minutes and restricting the reporting to 100 unique memory values, the risk of side-channel attacks is significantly reduced. This strategy makes it challenging for malicious entities to interpret minor fluctuations in memory usage.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Rearrange the layout by dragging and dropping images to switch their places

I've been working on implementing a photo uploader that requires the order of photos to be maintained. In order to achieve this, I have attempted to incorporate a drag and drop feature to swap their positions. However, I am encountering an issue where ...

Displaying a group of elements in ReactJS

I'm currently working on assembling an array using different JSX components. There's a function I've created that populates this array with components and then returns it. let components = []; switch (obj.type) { case 'title': ...

Implement a formatter function to manipulate the JSON data retrieved from a REST API within the BootstrapVue framework

My bootstrap-vue vue.js v2.6 app is receiving JSON data from a REST API. The data structure looks like this: { "fields": [ { "key": "name", "label": "name", & ...

Using JSON / jQuery: How to Handle XML Data in the Success Function of an AJAX Post Request

Greetings! I am currently performing an ajax post through a JSP. The JSON data is being sent in string format (parsed using parseJSON, then converted back to a string using JSON stringify). The post operation functions correctly. However, my query lies in ...

Error encountered while attempting to convert CSV file: InvalidStateError

I've implemented a JavaScript function to be triggered by the 'onclick' event of an HTML button: function exportReportData2() { if ($("#Report").val() != "") { var screenParametersList = buildScreenParameters(); var ...

The variable remains undefined, despite the fact that the code executes correctly in a different location

I'm currently working on a multiplayer game in three js and integrating socket.io for real-time communication. I have all the player characters stored in an array called players on the server side. When each client connects, I send them the list of p ...

Gatsby Functions: Exceeding payload size limit error - request entity too large

I am currently working on a Gatsby app and utilizing Gatsby Functions to obscure form submissions to an external API. The issue I am facing is that when a user attaches a file in the form, it could potentially surpass the default size limit of 100KB. While ...

Using setState in an external function: A step-by-step guide

import Request from 'superagent'; const fetchApi = () => { let apiUrl = '/* URL */'; return Request.get(apiUrl).then((response) => { this.setState({ data: response.body }); }); } export d ...

Sending a document through an ajax request from a bootstrap dialogue box

Trying to send a file to a server through a bootstrap modal using ajax. Here's the modal html: <div class="modal-body"> <div> <form class="form" role="form" id="attachform" enctype="multipart/form-data"> <input type="file" name= ...

What could be preventing the onclick event from functioning properly in JavaScript?

After creating a basic JavaScript code to practice Event handling, I encountered an issue where the function hello() does not execute when clicking on the "Click" button. What could be causing this problem? html file: <!DOCTYPE html> <html> ...

Can Vuex mapActions be utilized within a module that is exported?

Is it possible to utilize Vuex mapActions from an external module imported into a component? I am working on standardizing a set of functions in a vue.js web application. My goal is to import these functions into each component and pass necessary values f ...

What exactly are Node.js core files?

I recently set up my Node.js application directory and noticed a presence of several core.* files. I am curious about their purpose - can these files be safely removed? The setup involves installing Node.js alongside Apache using mod_proxy to host one of ...

Enhance the progression bar using JavaScript

Is there a way to dynamically update a progress bar in HTML while a function is running? function fillProgressBar() { var totalIterations = 100; for (var i = 1; i <= totalIterations; i++) { //perform calculations progressBarWidth = (i/to ...

$filter is functioning correctly, however it is generating an error message stating: "Error: 10 $digest() iterations reached. Aborting!"

Here is an example of a JSON object that I am working with: { "conversations":[ { "_id": "55f1595d72b67ea90d008", "topic_id": 30, "topic": "First Conversation", "admin": "<a href="/cdn-cgi/l/e ...

Simply output the integer value

Recently, I've been working on a function that I'm trying to condense into a one-liner code for a challenge on Codewars. You can find the problem here. Here's the code snippet that I currently have: export class G964 { public static dig ...

One-way communication between two clients using Socket.io

While working on a basic socket.io application using React and Express, I've encountered an issue where two clients are facing difficulties in sending data to each other. For instance: Player 1 connects to the server followed by Player 2. Player 1 ...

What measures do websites such as yelp and urbandictionary implement to avoid multiple votes from unregistered users?

It is interesting to note that on urbandictionary, you do not need to be logged in to upvote a definition. For example, if you visit and upvote the first word, it will record your vote. Even if you open an incognito window and try to upvote again, or use ...

Trouble with Fetching JSON Data using AJAX

Having trouble retrieving JSON data from an acronym finder API using a simple GET request. Here is the code I'm using: $.ajax('http://www.nactem.ac.uk/software/acromine/dictionary.py?sf=DOD', { crossDomain:true, dataType: "jsonp ...

JSON - The challenge of incorporating single quotes within double quotes

In my current scenario, I am using the following code to populate form fields. The code is designed to handle a JSON dataset that has been encoded with PHP's json_encode function. Everything works smoothly when dealing with either single or double qu ...

Performing the task of removing a complete script using D3 or JavaScript

Here is the current setup I have in my code: The index.html file contains <div id="div1"></div> and I dynamically load a file into it (when a socket arrives) using this script: <script> var socket = io.connect('http://127.0. ...