On Wed, May 04, 2022 at 09:46:50PM +0000, forkit via Digitalmars-d-learn wrote:
[...]
> That languages with GC typically give the programmer some control over
> the GC, is evidence that programmers do care (otherwise such features
> would not be needed).
> 
> To deny a programmer the option to release the memory that was GC
> allocated within a particular scope, to be release immediately after
> that scope exits, seems kinda cruel.
[...]

        scope ptr = GC.malloc(size);
        scope(exit) GC.free(ptr);

        ... // use ptr however you like until end of scope


T

-- 
It's amazing how careful choice of punctuation can leave you hanging:

Reply via email to