Re: Manually freeing up memory

2012-11-09 Thread Rob T
On Thursday, 8 November 2012 at 04:51:00 UTC, Marco Leise wrote: Could it be that you still hold a reference to the raw memory in your data structures ? A slice would be a typical candidate: Good point. I find that with GC'd memory, you have to diligently keep track of where and when your refe

Re: Manually freeing up memory

2012-11-08 Thread Joseph Rushton Wakeling
On 11/08/2012 05:50 AM, Marco Leise wrote: Could it be that you still hold a reference to the raw memory in your data structures ? A slice would be a typical candidate: s.name = raw[a .. b]; You probably checked that already... I don't _think_ so, although there is a point where data is passed

Re: Manually freeing up memory

2012-11-07 Thread Marco Leise
Am Wed, 07 Nov 2012 19:56:35 +0100 schrieb Joseph Rushton Wakeling : > On 11/07/2012 06:53 PM, H. S. Teoh wrote: > > I think on Posix systems, malloc/free does not return freed memory back > > to the OS, it just gets reused by the process later on. > > I have to say that in this program, it looks

Re: Manually freeing up memory

2012-11-07 Thread Joseph Rushton Wakeling
On 11/07/2012 06:53 PM, H. S. Teoh wrote: I think on Posix systems, malloc/free does not return freed memory back to the OS, it just gets reused by the process later on. I have to say that in this program, it looks like the memory usage keeps increasing even after the free(), even though theor

Re: Manually freeing up memory

2012-11-07 Thread H. S. Teoh
On Wed, Nov 07, 2012 at 06:12:52PM +0100, bearophile wrote: > Joseph Rushton Wakeling: > > >... but despite the GC.free(), memory usage stays at peak level > >for the rest of the runtime of the function. > > GC.free() usually works. Some memory allocators don't give back the > memory to the OS, n

Re: Manually freeing up memory

2012-11-07 Thread bearophile
Joseph Rushton Wakeling: ... but despite the GC.free(), memory usage stays at peak level for the rest of the runtime of the function. GC.free() usually works. Some memory allocators don't give back the memory to the OS, no matter what, until the process is over, despite that memory is free f

Re: Manually freeing up memory

2012-11-07 Thread Joseph Rushton Wakeling
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

Re: Manually freeing up memory

2012-11-07 Thread bearophile
Joseph Rushton Wakeling: 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_". One sol

Manually freeing up memory

2012-11-07 Thread Joseph Rushton Wakeling
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, wh