Re: Memory tracking in GJS

2014-02-20 2:50 GMT+01:00 Cosimo Cecchi <cosimoc gnome org>:
Hi all,

The state of garbage collection for typical GTK/JS applications is pretty
sad these days. mozjs will execute a garbage collection run when it thinks
around 30MB of allocations have been done.

It's worth pointing out that mozjs will *force* a garbage collect if
you go over the malloc limit (a dynamic value between 30 and 90 MB),
but will garbage collect a lot more often if you call MaybeGC. Firefox
does that at the end of the every user script (with a comment saying
it's for sunspider), maybe we can do the same in gjs?
Additionally, gjs does not support the more advanced forms of GC, so
they trigger less often and block longer. See #724797 for incremental
GC for example.

Any other ideas? I feel this is a fundamental enough issue that there must
be a good way to design a generic solution.

We can probably look into mallinfo() as well, it offers a reasonable
estimate of the memory usage for a single threaded application
(because most allocations happen from the main arena).


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]