iPhone vs Android

finalpatch via Digitalmars-d digitalmars-d at puremagic.com
Wed Sep 14 06:28:45 PDT 2016


On Tuesday, 13 September 2016 at 18:24:26 UTC, deadalnix wrote:
> No you don't, as how often the GC kicks in depend of the rate 
> at which you produce garbage, which is going to be very low 
> with an hybrid approach.

This is simply not true.

Assume in a pure GC program the GC heap can grow up to X Mb 
before a collection cycle happens, which has to scan X Mb of 
memory.

Now let's say we have a hybrid program that uses 0.5X Mb of RCed 
memory and 0.5X Mb of GC memory so the total memory consumption 
is still X Mb. When the GC heap reaches 0.5X Mb, it has to scan 
both RC and GC memory.

It's quite obvious that the time(t) it takes for program 1 to 
produce X Mb of garbage is the same as program 2 to produce 0.5X 
Mb of garbage, and after time t, both program have to scan X Mb 
of memory.  However program 2 also has to pay the cost of 
reference counting on top of that.

When you say hybrid program should trigger GC at a lower rate, 
you are actually assuming the hybrid program also has X Mb of GC 
heap, which makes total memory consumption 1.5X Mb, therefore it 
is not a fair comparison anymore.


More information about the Digitalmars-d mailing list