BCS wrote:
Hello Sam,

Greeting to everybody,

If this is too silly a question,please just ignore it.

I was wondering what if GC is turned off during the lifetime of the
application?Just as if D is a better,safer/unsafer C with class?Can't
work?Or some special stuff need to handle?


There are some parts of D (like AA) that allocate memory from the GC but for which it would be hard to impossible for the programmer to tell when to deallocate. If you use these features while the GC is off, you will leak memory untill you turn it back on (at that point the GC will clean it up). In some short lived programs this is no problem.

As for AAs, you should be able to replace them with Tango's tango.util.container.HashMap with the tango.util.container.Container.Container.Malloc (or .Chunk) allocator.

It might be tricky to find memory leaks due to accidental GC usage, but you could e.g. hook the GC methods ( http://dsource.org/projects/kong ) (or modify the GC) and print stack traces in them.


--
Tomasz Stachowiak
http://h3.team0xf.com/
h3/h3r3tic on #D freenode

Reply via email to