want to confirm: gc will not free a non-gc-allocated field of a gc-allocated object?

max haughton maxhaton at gmail.com
Tue Jun 7 09:00:52 UTC 2022


On Tuesday, 7 June 2022 at 08:56:29 UTC, ag0aep6g wrote:
> On 07.06.22 03:02, max haughton wrote:
>> I'm talking about the data in the array.
>> 
>> void[] might contain pointers, float[] does not so it won't be 
>> scanned.
>
> That wasn't mw's question.

I also answered this in my original one IIRC. There's nothing too 
free because the GC didn't allocate it.

Every allocator needs to either have a GC or a fast way to free 
memory which includes checking whether it owns memory in the 
first place. annoyingly you can't express this in the malloc/free 
pattern very well at all. One of the many gifts C has given the 
world.


More information about the Digitalmars-d-learn mailing list