Discussion on Go and D
Chad J
chadjoan at __spam.is.bad__gmail.com
Sat Apr 7 14:26:09 PDT 2012
On 04/06/2012 02: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().
>
I keep reading that 'delete' is going to go away. Is this even
future-proof, or is code written in this fashion going to suffer a
reckoning later on?
As an aside: I think this point generalizes to "avoid using the GC in
cases where it is easy to do so". D is very good at this due to having
expressive structs, scope keyword, array slices, and a number of other
features that synergize to track ownership/lifetime of memory without GC
help.
> 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.
More information about the Digitalmars-d
mailing list