Idea about memory management. Game related.

pragma pragma_member at pathlink.com
Mon Jun 12 13:18:47 PDT 2006


In article <e6kd4u$300u$1 at digitaldaemon.com>, Chad J says...
>
>Once it executes A = B, the memory held by what was once A is leaked 
>until a garbage collection occurs.  I'm not sure, but this could mean 
>longer and more frequent garbage collections, unless you avoid 
>allocating on the gc heap altogether for the rest of the program's 
>execution.  This would call for some manual management, like so:
>
>byte[] A = new byte[128];
>byte[] B = new byte[64];
>delete A;
>A = B;

Wouldn't it be safe to say that if one were very pedantic about manually
deleting everything they weren't using, that any pending GC cycle would be
marginalized considerably?  After all, the GC spends a lot of its time figuring
out what we already know at the point of deletion - that is, what is in use and
what is not.

- EricAnderton at yahoo



More information about the Digitalmars-d mailing list