Good to the last drop.

Paul Backus snarwin at gmail.com
Thu Mar 31 21:30:42 UTC 2022


On Thursday, 31 March 2022 at 19:44:23 UTC, WhatMeWorry wrote:
> Is there a way to programmatically determine the exact maximum 
> memory size available to the DRuntime’s array implementation?

Closest you can get is probably [`GC.stats`][1], which will give 
you the total amount of free memory available to the GC.

If what you actually want to do is attempt to grow an array 
without crashing if there isn't enough memory, you can use 
[`GC.extend`][2]. There's an example in the linked documentation 
that shows how to do it.

[1]: https://druntime.dpldocs.info/core.memory.GC.stats.html
[2]: https://druntime.dpldocs.info/core.memory.GC.extend.html


More information about the Digitalmars-d-learn mailing list