On 11/07/2012 03:17 PM, bearophile wrote:
One solution is to allocate the original array on the C heap. Another solution
is to allocate it normally from the GC heap and then use GC.free().

Well, what I've got is something like this:

      auto raw = rawInput();      /* loads data and outputs a struct containing
                                     the array of data */
      auto data = rawToData(raw); // converts the raw input to data structure
      GC.free(raw.links.ptr);     // _should_ free up the allocated memory?

... but despite the GC.free(), memory usage stays at peak level for the rest of the runtime of the function.

I tried preceding the free() with a destroy(raw) or destroy(raw.links) also to no avail.

Maybe a third option is to use a memory-mapped file for the first array.

That's an interesting thought, which I'll look into. Another thought was to dump the data into an SQL DB and read/sample from there as necessary, but IIRC the SQL support available for D is somewhat limited right now ... ?

Reply via email to