> Am 12.03.2016 um 07:27 schrieb Brian Barnes:
>> Request 1: Add a System module, and one call I need System.gc();
>>
>> Why: My game works in two parts; one part creates all the content, and
>> then the second part plays it.  In the second part, I do as much as I
>> can to precreate/re-use any objects or arrays I need, to reduce GC.  On
>> the creation part, I don’t as much.  So being able to force a GC at a
>> point helps me, because it stops the creation part from forcing a pause
>> in the game part.

On 13 March 2016 at 01:05, Christian Mayer <[email protected]> wrote:
> On my user-should-experience-no-pause kind of application I'd also love
> to have the possibility to tell the engine to do a GC *now* as it's a
> good time point to do it.

Problem with that is that you're making assumptions that are not
guaranteed about the engine already:
 - That it uses a garbage collector. (I believe it's not entirely
implausible to compile JS to a manually memory managing engine
internal code, and I know that there are engines that never return any
memory while still running, though they might reuse unreachables.)
 - That the eventual garbage collector has certain properties such as
pausing execution.
 - That eventual garbage collector isn't incremental and running very
small slices practically all the time, which might make precise user
code control over it a deoptimisation hazard.
 - That dead object detection, garbage collection, memory compaction
and resource handling is dealt with in the ways of a typical
conservative mark & sweep fashion.
 - That ECMAScript actually specifies any of this. Neither garbage
collection, nor memory handling strategies are a part of the spec. In
fact, the word "memory" is only mentioned three places in the entire
ECMAScript 2015 spec, and "garbage collection" only once.

-- 
David "liorean" Andersson
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to