JS Heap recommended memory size
Is there any limit to the heap size in the chrome memory profile ?
Note: This is a Chrome only answer, see below why.
You should take a look at window.performance.memory
in Chrome Dev Tools, there is a jsHeapSizeLimit
attribute. However, I'm not sure this will be the maximum value on any memory profiling y-axis
You can find more informations on MDN : https://developer.mozilla.org/en-US/docs/Web/API/Window/performance
performance.memory :
A non-standard extension added in Chrome.
Linked in MDN : https://docs.webplatform.org/wiki/apis/timing/properties/memory
performance.memory :
Note: This property is read-only.
console.log(performance.memory)
// Would show, for example
//{
// jsHeapSizeLimit: 767557632,
// totalJSHeapSize: 58054528,
// usedJSHeapSize: 42930044
//}
Notes
usedJsHeapSize is the total amount of memory being used by JS objects including V8 internal objects, totalJsHeapSize is current size of the JS heap including free space not occupied by any JS objects. This means that usedJsHeapSize can not be greater than totalJsHeapSize. Note that it is not necessarily that there has ever been totalJsHeapSize of alive JS objects.
See the WebKit Patch for how the quantized values are exposed. The tests in particular help explain how it works.
Be careful, values are expressed without units because there isn't. This is because webkit does not want to expose system informations such as available memory size. It only provide a way to compare memory usage (for instace between two different versions of a website).
In theory the memory limit (not LocalStorage, but actual memory) is unlimited, and only bounded by the amount of RAM on the system. In practice, most web browsers will place a limit on each window (for example, 200MB). Sometimes the limit is customizable by the user. Additionally, an operating system can put a limit on the amount of memory used by an application.
链接地址: http://www.djcxy.com/p/91142.html上一篇: 如何在使用MiniProfiler时从配置文件中删除特定的URL
下一篇: JS堆建议的内存大小