What's the D way of allocating memory?

Gary Willoughby dev at nomad.so
Wed Aug 7 11:40:26 PDT 2013


On Wednesday, 7 August 2013 at 17:47:38 UTC, monarch_dodra wrote:
> If you want to do "semi-manual" memory management, you can use 
> GC.malloc, which works like normal malloc, but is *still* 
> managed by the GC. I'd actually recommend "GC.qalloc" over 
> "GC.malloc": it's the same function, but qalloc actually 
> returns more info, such as the total amount of memory 
> *actually* allocated. This is very useful when you need a 
> buffer of arbitrary size, as you get the most out of your 
> allocation. The memory can also be eagerly marked as unused 
> with "GC.free", although you'll still have to wait for a 
> collect for it to actually be freed.

Interesting. How do i access GC.malloc?


More information about the Digitalmars-d-learn mailing list