GC vs. Manual Memory Management Real World Comparison

Rob T rob at ucora.com
Fri Oct 26 18:03:55 PDT 2012


On Friday, 26 October 2012 at 23:10:48 UTC, bearophile wrote:
> Rob T:
>
>> Is this happening with dmd 2.060 as released?
>
> I'm using 2.061alpha git head, but I guess the situation is the 
> same with dmd 2.060. The code is linked in my post, so trying 
> it is easy, it's one small module.
>
> Bye,
> bearophile

I tried it with dmd 2.60 (released), and gdc 4.7 branch. I tried 
to check if memory was being freed by creating a struc destructor 
for JavaMemoryTrade, but that did not work as expected, leading 
me down the confusing and inconsistent path of figuring out why 
destructors do not get called when memory is freed.

Long story short, I could not force a struct to execute its 
destructor if it was allocated on the heap unless I used delete. 
I tried destroy and clear, as well as GC.collect and GC.free(), 
nothing else worked.

Memory heap management as well as struct destructors appear to be 
seriously broken.

--rt



More information about the Digitalmars-d-announce mailing list