Why many programmers don't like GC?

mw mingwu at gmail.com
Thu Jan 14 18:10:43 UTC 2021


On Thursday, 14 January 2021 at 09:26:06 UTC, Ola Fosheim Grøstad 
wrote:
> On Thursday, 14 January 2021 at 00:37:29 UTC, mw wrote:
>> ok, what I really mean is:
>>
>> ... in other "(more popular) languages (than D, and directly 
>> supported by the language & std library only)" ...
>
> Well, even Python supports both

Python's `del` isn't guaranteed to free the memory, that's what 
we are discussing here: core.memory.GC.free / 
core.stdc.stdlib.free

https://www.quora.com/Why-doesnt-Python-release-the-memory-when-I-delete-a-large-object

In CPython (the default reference distribution), the Garbage 
collection in Python is not guaranteed to run when you delete the 
object - all del (or the object going out of scope) does is 
decrement the reference count on the object. The memory used by 
the object is not guaranteed to be freed and returned to the 
processes pool at any time before the process exits. Even if the 
Garbage collection does run - all it needs is another object 
referencing the deleted object and the garbage collection won’t 
free the object at all.




More information about the Digitalmars-d-learn mailing list