Manually freeing up memory
Joseph Rushton Wakeling
joseph.wakeling at webdrake.net
Wed Nov 7 05:52:03 PST 2012
Hello all,
I'm doing some work with a fairly large dataset. For various reasons it's
convenient to import it first as simply an array of data points which is then
used to generate other data structures (actually, technically it's an array of
data points plus a couple of associative arrays, which ideally would instead be
sets; but I think that's a minor detail).
Once the various data structures are in place, it's possible to discard the
initial array data. It would be very desirable to free up the memory allocated,
as it's a very large amount. However, I can't work out how to do this.
I've tried calling destroy() on the input data, with and without a subsequent
GC.collect(), but the program's memory usage still remains at its peak level.
This is a shame, because that peak memory usage only needs to last for a short
part of the program's total runtime, and it seems only polite to other computer
users to give back the excess memory.
Can anyone advise? I would rather not disable the GC entirely as there's lots
of Phobos I want to be able to use -- but I'd really like it if I could indicate
categorically to the GC, "these objects and arrays need to be deleted and the
memory freed _now_".
Thanks and best wishes,
-- Joe
More information about the Digitalmars-d-learn
mailing list