iPhone vs Android

Paulo Pinto via Digitalmars-d digitalmars-d at puremagic.com
Wed Sep 14 01:31:29 PDT 2016


On Wednesday, 14 September 2016 at 07:16:04 UTC, deadalnix wrote:
> On Wednesday, 14 September 2016 at 05:38:38 UTC, Shachar 
> Shemesh wrote:
>> On 14/09/16 02:59, Walter Bright wrote:
>>>[...]
>>
>> But if you do want to allow it, then my original problem comes 
>> back. You have to scan the malloced memory because you are not 
>> sure where that memory might contain pointers to GC managed 
>> memory.
>>
>> And the hybrid hybrid approach (i.e. - only some of the memory 
>> allocated by malloc is scanned) is a wasp nest of potential 
>> bugs and problems.
>>
>> Shachar
>
> Cool down, take a step back.
>
> There are memory management technique that can give you good 
> result in most case, but will degenerate is few others. For 
> instance RC doesn't handle cycles, plays poorly with 
> exceptions, and so on.
>
> There are ways to make RC work in all these case, but it is has 
> severe drawbacks. Now, if you allocate using a GC, and use RC 
> on top of it, you get 99% of the garbage cleaned up as you 
> expect. But it allows the RC system to just delegate to the GC 
> for cases it is not good at.
>
> That way you get very occasional collection cycles to the point 
> where it is usually not a problem, and if you are smart about 
> it, you can even trigger them yourself at appropriate time. If 
> 99% of the garbage is cleanup up by the RC mechanism, the the 
> garbage accumulate at 1% the rate of what it would with a 100% 
> GC system, and, consequently, you can run collection 1/100 time 
> what you would with a pure GC system with the same memory 
> overhead.
>
> Now you may ask, how am I so sure that this is working great ? 
> The short answer is PHP.

As extra info, it was the approach taken by Cedar at Xerox PARC 
as well.

RC for almost everything, with a local tracing GC for collecting 
cycles.

https://archive.org/details/bitsavers_xeroxparcteCedarProgrammingEnvironmentAMidtermRepo_13518000

https://archive.org/details/bitsavers_xeroxparctddingGarbageCollectionandRuntimeTypestoa_1765837


More information about the Digitalmars-d mailing list