www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - GC don't work well

reply "Katayama Hirofumi MZ" <katayama.hirofumi.mz gmail.com> writes:
Look this source:
http://codepad.org/QXAeG2aJ

The content of RbArray won't be released at the moment of 
deleting an RbArray.

Why?  Is it a bug?
May 29 2012
next sibling parent Jonathan M Davis <jmdavisProg gmx.com> writes:
On Wednesday, May 30, 2012 07:47:22 Katayama Hirofumi MZ wrote:
 Look this source:
 http://codepad.org/QXAeG2aJ
 
 The content of RbArray won't be released at the moment of
 deleting an RbArray.
 
 Why?

It's probably only releasing the memory for RbArray and not what it refers to. m_objects is a dynamic array, and so it's memory is elsewhere on the heap rather than being part of RbArray itself. So, it probably doesn't get released when the RbArray is deleted.
  Is it a bug?

Even if it were, it wouldn't get fixed. delete is being removed from the language. You really shouldn't be using it. - Jonathan M Davis
May 29 2012
prev sibling parent =?UTF-8?B?QWxleCBSw7hubmUgUGV0ZXJzZW4=?= <alex lycus.org> writes:
On 30-05-2012 07:47, Katayama Hirofumi MZ wrote:
 Look this source:
 http://codepad.org/QXAeG2aJ

 The content of RbArray won't be released at the moment of deleting an
 RbArray.

 Why? Is it a bug?

Just use GC.collect() from core.memory when cleaning up internals of extremely large objects is too troublesome. -- Alex Rønne Petersen alex lycus.org http://lycus.org
May 30 2012