How to query available memory within a web browser implementation of a three.js program

I am starting this new topic since my search has not revealed a same/similar one. The topic statement says it all.

Ideally, a function that can be called at any point in a three.js program that will state the amount of (a) stack and (b) heap memory still available to that program running in one tab of a web browser.

Also ideally, something that works across all web browsers.

If not available, your suggestions on how to get close to this.

Thanks much!!

If you’re talking about WebGL specifically, don’t think querying memory usage in JavaScript can be done because that information can be used for fingerprinting.

See also: profiling - How to measure Graphic Memory Usage of a WebGL application - Stack Overflow

As for JavaScript memory usage, perhaps the performance-object may be of use. See here: javascript - Possible to check 'available memory' within a browser? - Stack Overflow

Thanks for those inputs.
When you talk of WebGL memory, are you referring to the RAM on the GPU?
I’m not overly concerned about that.
The concern is with RAM on the “host”. ie: main system memory on a personal computer, some of which is accessible to a tab within a web browser.


I think the performance object should be able to provide what you need then. Be aware though, as the MDN pages state that this functionality is experimental or deprecated even. I would suggest against this if you’re targeting a wide range of browsers.