> On Mar 13, 2016, at 11:21 PM, /#!/JoePea <[email protected]> wrote: > > That sounds like a good idea, being able to hint to the browser when > is a good point to GC, and also when to avoid GC if possible. > > Idea: Maybe we have an animation that last 500 ms. Before the > animation, we can call `System.preventGC()`, and the browser can > prevent GC for as long as possible, but will still do it if absolutely > necessary (i.e. if memory needs to be freed to allocate more). Then, > after that animation finishes, a call to `System.attemptGC()` could > signal the browser to go ahead if it hasn't already. This ability to > hint could be very handy. It's like requestAnimationFrame: it is used > to hint at the browser that some code should be run between frames, > but it doesn't guarantee that the code won't cause jitter if the code > exceeds time limits, it's just a hint. We could use some way to hint > at GC too.
I think if this problem is at all solvable, it’s going to require a lot of methods, to cover a lot of different situations, and each one does something minor as to not radically change the engines ability to manage it’s own memory. I like the above, but worried that things could return without calling attemptGC(), maybe something scoped to a function? Or even maybe requestAnimationFrame itself could have some kind of flag that says “try to not GC unless you really have to.” Regardless, something like is needed to. The ultimate solution — because it’s a GC system — is to not allocate anything. That makes messy, spaghetti code, though. [>] Brian _______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

