Heap memory limit?
Robert Jacques
sandford at jhu.edu
Tue Feb 23 08:27:22 PST 2010
On Tue, 23 Feb 2010 08:36:04 -0500, bearophile <bearophileHUGS at lycos.com>
wrote:
> The Java VM has a limit of the amount of memory it allocates from the
> heap. So is it useful to add a way to specify a similar limit for D2
> programs (especially ones made by safe module)? This limit can be given
> to the D GC heap (and maybe to the C heap too).
>
> This limit can just be a compile-time constant given to the compiler,
> this produces a binary that has a limit of 200 MB of heap:
> dmd -mlimit=200mb foo.d
> The situation gets less simple if you want to change such limit after
> the program is already compiled, I don't know of simple ways to do it.
> Maybe a second program can be used for that:
> gclimiter -mlimit=100mb foo.exe
>
> Bye,
> bearophile
My gut feeling is that you are confusing free heap memory with total heap
memory, because I know of lots of Java programs where I seamlessly
allocate more than 200mb on a regular basis. I mean, consider a user with
gigs of memory free suddenly getting an out of memory error. Anyways, as
others have mentioned, this seems like a fairly trivial addition to
druntime's GC.
More information about the Digitalmars-d
mailing list