This actually touches on a "deep" issue, one that has a lot of potential to positively impact the performance of functions that allocate memory. But a good incremental/generational GC is a tricky thing to get right. Fortunately, a brave and capable soul has already submitted a very exciting pull request: https://github.com/JuliaLang/julia/pull/5227
One can never be sure, but I suspect this will be merged early in 0.4's development. --Tim On Monday, March 10, 2014 12:15:58 PM Daniel H wrote: > Hi all, > > I find that Julia's GC doesn't collect garbage regularly, so the computer > might run out of memory and starts swapping. > > Here's what I did > A = <a big matrix. After A is defined, there would be 1.1 GB free memory > left> > > > B = <a random matrix of 500 MB> > > > C = <a random matrix of 500 MB> > # so now there's only 100 MB free on the memory > > > C = 0 > # still 100MB free.... Julia not cleaning up Memory. MATLAB would free the > memory at this point > > > B = <a random matrix of 500 MB> > # run out of RAM, now stuff get written to disk > > I wonder if there's any setting that make Julia do GC whenever possible? > For example, in this case, GC would do something when I set C = 0.
