Hi Andrew, No answer here, just some behaviour that might be of interest to you (everything I write pertains to v0.3. I've no experience with v0.4 and I understand some fairly large changes have occurred in garbage collection). I faced the problem in my work of reading in lots of data from the hard disk, performing some operations on it, and then needing to ditch it to free up space in RAM for more data to be read from hard disk. Like you, I called `gc()` inside a function to do this. I then ran the program and watched the RAM usage counter on my system monitor to see what happened. What I expected to see was RAM usage building up as I read in data, then dropping back close to zero when I ditch it and call `gc()`. This is not what happened. Instead, the RAM usage counter ramped up to the upper limit I had set using a conditional if statement, and then when it hit that limit, it just stopped. It didn't go down or up. The only way to get it back to zero was to quit Julia. However, the program ran to completion and read in *much* more from the HDD than could be stored in RAM, so clearly some sort of disposal was happening under the hood. It just didn't show up on the system RAM usage counter. Interestingly, the behaviour is identical even if I comment out the `gc()` line.
So... as I said, no answer, except that in my case, garbage collection was working as it should, it just wasn't visible from watching the system RAM usage counter. Cheers, Colin On Wednesday, 5 August 2015 10:39:22 UTC+10, Andrew B. Martin wrote: > > Thanks for the explanation, Yichao. > > If I want to delete the object and free up the memory, what should I do? >