Get largest heap object at runtime? ...tracking the leak

thedeemon dlang at thedeemon.com
Mon Jan 22 17:58:10 UTC 2018


On Monday, 22 January 2018 at 16:37:19 UTC, Andres Clari wrote:
>> All threads withing a process share the same heap, so whatever 
>> one thread allocated in that heap is not freed or reclaimed 
>> automatically when thread dies, it stays in the heap.
>
> Well the destructor of some Json objects and strings should be 
> called when the thread exits tho.

If some objects were on the stack of the thread proc, their 
destructors run, yes, as usual for leaving a scope. Strings don't 
have destructors, afaik.
Thread-local storage gets cleaned up too. But everything that 
lives in heap, stays there, until GC finds them. Objects in heap 
don't have any information on them  which thread they belong to.



More information about the Digitalmars-d-learn mailing list