[webkit-dev] Memory Manager
pbouchard8 at gmail.com
Mon Dec 22 15:41:42 PST 2014
On 12/22/2014 10:02 AM, Filip Pizlo wrote:
(Sorry for the late reply)
>> This is a good presentation on how it handles it:
>> You basically have "sets" of memory blocks (i.e. container = 1 set). If you merge the sets they become one big set. When the last pointer from the stack is deleted then the entire set is also destructed.
> Yup, you reinvented regions.
As I read it region based memory manager use contiguous memory blocks
which get destroyed as a whole without calling any destructor I can
imagine, etc. The block pointer is much more refined than that.
>>> You would need a tremendous amount of evidence to convince us that this
>>> is usable for our purposes. Our GC may have its performance issues but
>>> it is very robust.
>> I understand that but the garbage collectors have been tested for decades. The block pointer is just freshly baked and is already functional.
> And the block pointer doesn't work for JSC and probably never will. For example each object's set will be unified with the set of its structure, which will be unified with the empty object structure, which in turn will be unified with the global object. Then the global object will be unified with its parent global object, and its internal objects will be unions with all of the internal types hanging off VM.
> So, everything will become a member of one giant set and the VM will leak memory and never free anything.
> The reason why we use GCs instead of regions is that regions are well understood as an impractical approach to general memory management.
Well then may I suggest a hybrid solution? You put a GC on top of the
block pointer, this way you take the best of both worlds.
I can easily add statistics, scan for inner cycles inside a set when
some memory usage threshold is reached and remove least used allocations.
>> I'm just talking about the worst case scenario here but when the garbage collector kicks in on a small set-top box the whole system is easily frozen.
>> How many times the garbage collector will kick in when you use the browser for a week on a set-top box? At least once a day, hopefully not when you're watching the 4th quarter of an important football game.
> Your approach means that in the middle of the football game the browser will crash.
> I think that if you're concerned with this scenario, you should implement a concurrent GC. I would be happy to provide some guidance on how to do it; I've had a plan for this for a while now.
I can add a GC on top of the block pointer, run benchmarks and see what
More information about the webkit-dev