General Problems for GC'ed Applications?

Walter Bright newshound at digitalmars.com
Fri Jul 28 17:03:35 PDT 2006


Karen Lanrap wrote:
> Anyway, here ist the code:

I'm not sure what this code represents. ("vital" is not any memory 
allocation term I'm familiar with.)

1) Certainly, allocating huge numbers of megabyte arrays all pointing to 
each other is not at all normal use.

2) Memory is not going to be recycled if there exist pointers to it from 
other memory blocks that are in use.

3) D's GC doesn't return memory to the operating system, it keeps the 
"high water mark" allocated to the process. But this doesn't actually 
matter, since it is only consuming *virtual* address space if it is 
unused. Physical memory is only consumed if it is actually and actively 
referenced.

4) Most C malloc/free and C++ new/delete implementations don't return 
memory to the operating system after the free, either.

5) When you use -lg, what the code appears to do is allocate new memory 
blocks. But since the old blocks are *still actively pointed to*, they 
won't be released by the GC.



More information about the Digitalmars-d mailing list