It seems to be a combination compiler/gc bug, because I don't run out of memory when I take the declaration out of the definition of v*. So, consider the attached code. Just load it into sbcl to see the crash.
Take a look at the total bytes allocated in the gc log files with gnuplot, and a command like:
plot "< awk '/Total bytes/ {n++ ; print n, $5}' testgc4-ok.log" w l, "< awk '/Total bytes/ {n++ ; print n, $5}' testgc4-crash.log" w l
Without the declaration, it doesn't grow too much over time. With the declaration, it keeps ratcheting up until the heap is exhausted.
I just built SBCL 1.2.10.72-c2a4aec, and it's not as bad. It can survive many calls to testcrash with 1mb arrays, and appears to use less memory in general. However, it's still the case that far more memory is used when the declaration is used, and it crashes pretty quickly when using 2mb arrays.
Also, I find the amount of garbage being retained to be surprising. A 2mb array of doubles is just 16mb, and only 3 are active at any time, which accounts for 48mb, yet the memory usage is becoming as 700mb. Use 5mb arrays instead, for a footprint of 120mb, and it quickly is unable to GC & crashes.
It seems to be a combination compiler/gc bug, because I don't run out of memory when I take the declaration out of the definition of v*. So, consider the attached code. Just load it into sbcl to see the crash.
Take a look at the total bytes allocated in the gc log files with gnuplot, and a command like:
plot "< awk '/Total bytes/ {n++ ; print n, $5}' testgc4-ok.log" w l, "< awk '/Total bytes/ {n++ ; print n, $5}' testgc4-crash.log" w l
Without the declaration, it doesn't grow too much over time. With the declaration, it keeps ratcheting up until the heap is exhausted.
I just built SBCL 1.2.10.72-c2a4aec, and it's not as bad. It can survive many calls to testcrash with 1mb arrays, and appears to use less memory in general. However, it's still the case that far more memory is used when the declaration is used, and it crashes pretty quickly when using 2mb arrays.
Also, I find the amount of garbage being retained to be surprising. A 2mb array of doubles is just 16mb, and only 3 are active at any time, which accounts for 48mb, yet the memory usage is becoming as 700mb. Use 5mb arrays instead, for a footprint of 120mb, and it quickly is unable to GC & crashes.