Discussion on Go and D

Rainer Schuetze r.sagitario at gmx.de
Fri Apr 6 15:08:13 PDT 2012



On 4/6/2012 8:01 PM, Walter Bright wrote:
> On 4/6/2012 10:37 AM, Rainer Schuetze wrote:
>> I hope there is something wrong with my reasoning, and that you could
>> give me
>> some hints to avoid the memory bloat and the application stalls.
>
> A couple of things you can try (they are workarounds, not solutions):
>
> 1. Actively delete memory you no longer need, rather than relying on the
> gc to catch it. Yes, this is as unsafe as using C's free().

Actually, having to deal with lifetime issues myself takes away the 
biggest plus of the GC, so I am a bit reluctant to do this.

>
> 2. Null out pointers & references when you are done with them. This
> helps reduce unwanted pinning of unused gc memory.
>
> 3. Minimize use of global memory, as that is a major source of source of
> roots.

I don't think there are many places in the code where these hints might 
apply. Are there known ways of hunting down false references?

Still, my main concern are the slow collections that stall the 
application when a decent amount of memory is used. Removing false 
pointers won't change that, just make it happen a little later.


More information about the Digitalmars-d mailing list