How to use destroy and free.
forkit
forkit at gmail.com
Wed May 4 22:04:53 UTC 2022
On Wednesday, 4 May 2022 at 21:55:18 UTC, H. S. Teoh wrote:
> 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
that's cruel!
I just want 'scope-based deallocation of GC allocated memory'.
I just want to write one word for this to happen -> 'inscope'
More information about the Digitalmars-d-learn
mailing list