Re:Ask HN: Why do langs with alleged “automatic memory manag...
by brianush1 on Thursday July 18, 2019 @04:17PM
(#20473551)
If we're being pedantic here, destructors don't manage memory at all, they only free resources. Memory is freed by the caller of the destructor, either automatically if the memory was allocated on the stack, or manually by the delete operator if the memory was allocated on the heap.
[ Parent
| on HN ]
Re:Ask HN: Why do langs with alleged “automatic memory manag...
by Someone on Thursday July 18, 2019 @08:22PM
(#20475233)
Memory is a resource, too, and C++-style destructors do manage it, sometimes.
Destructors do not free the memory of the object being destroyed, but they can free memory that its fields point to.