<div dir="ltr">Steve;<br><br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Yup, it probably needs some work, and at least I think reference-based<br>
garbage collection is a little easier to get right than the "hunt<br>
through memory for pointers" style. Though each has its own downsides<br>
if I recall, such as cyclical references.<br>
<div class="Ih2E3d"></div></blockquote><div><br>Well, anything is better then clogging up the whole CPU with periodic collection; we can't afford that.<br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d"><br>
</div>Well, I'm not sure if I understand what you're saying, but what's<br>
happening is that 'f' references a new Foo, and then that foo is added<br>
to the array. When it's later replaced, it's not garbage collected<br>
because 'f' still references it. But when 'f' is made to point<br>
somewhere else, *then* it gets garbage collected, which for some<br>
reason causes an exception.<br>
<br>
Appended 'int f' doesn't make much sense though since the problem<br>
doesn't lie with 'f', but with what 'f' points to. It'll just say<br>
that 'f' is already defined.<br>
<div class="Ih2E3d"></div></blockquote><div><br>I may have made a reasoning error but I wanted to test to see whether when the object under "f" is collected the reference, named "f", was still there. I knew this was a naive test but still wanted to run it.<br>
<br>We're definitely having some kind of big-ish trouble here; I just saw ChucK spew out a amount of data at crashing. I've never seen it do anything like this before. Pasted below in case it means something to someone. At least I now got Mike's Unit-tests to go beyond where his comments say it gives a "bus error"... out of the frying pan and into the fire. I archived the state the code was in at this point in case this is relevant; zip-file on request.<br>
<br>Yours,<br>Kas.<br><br>--------------------start paste----------------------------<br>*** glibc detected *** chuck: double free or corruption (!prev): 0x0842b7e8 ***<br>======= Backtrace: =========<br>/lib/tls/i686/cmov/libc.so.6[0xb7bf2a85]<br>
/lib/tls/i686/cmov/libc.so.6(cfree+0x90)[0xb7bf64f0]<br>/usr/lib/libstdc++.so.6(_ZdlPv+0x21)[0xb7e1eb11]<br>/usr/lib/libstdc++.so.6(_ZdaPv+0x1d)[0xb7e1eb6d]<br>chuck[0x8055f6f]<br>chuck[0x80596da]<br>chuck[0x809a652]<br>chuck[0x805944e]<br>
chuck[0x80594d2]<br>chuck[0x80c4ed5]<br>chuck[0x80d2048]<br>chuck[0x80cc8e8]<br>/lib/tls/i686/cmov/libpthread.so.0[0xb7b744fb]<br>/lib/tls/i686/cmov/libc.so.6(clone+0x5e)[0xb7c5de5e]<br>======= Memory map: ========<br>08048000-081ac000 r-xp 00000000 08:01 1165811 /usr/bin/chuck<br>
081ac000-081d3000 rw-p 00164000 08:01 1165811 /usr/bin/chuck<br>081d3000-0845c000 rw-p 081d3000 00:00 0 [heap]<br>b6200000-b6221000 rw-p b6200000 00:00 0 <br>b6221000-b6300000 ---p b6221000 00:00 0 <br>b6311000-b6312000 ---p b6311000 00:00 0 <br>
b6312000-b6b12000 rw-p b6312000 00:00 0 <br>b6b12000-b6b13000 ---p b6b12000 00:00 0 <br>b6b13000-b7313000 rw-p b6b13000 00:00 0 <br>b7313000-b7314000 ---p b7313000 00:00 0 <br>b7314000-b7b16000 rw-p b7314000 00:00 0 <br>b7b16000-b7b1a000 r-xp 00000000 08:01 1165578 /usr/lib/libogg.so.0.5.3<br>
b7b1a000-b7b1b000 rw-p 00003000 08:01 1165578 /usr/lib/libogg.so.0.5.3<br>b7b1b000-b7b6e000 r-xp 00000000 08:01 1165787 /usr/lib/libFLAC.so.8.2.0<br>b7b6e000-b7b6f000 rw-p 00052000 08:01 1165787 /usr/lib/libFLAC.so.8.2.0<br>
b7b6f000-b7b83000 r-xp 00000000 08:01 3965681 /lib/tls/i686/cmov/<a href="http://libpthread-2.7.so">libpthread-2.7.so</a><br>b7b83000-b7b85000 rw-p 00013000 08:01 3965681 /lib/tls/i686/cmov/<a href="http://libpthread-2.7.so">libpthread-2.7.so</a><br>
b7b85000-b7b87000 rw-p b7b85000 00:00 0 <br>b7b87000-b7cd0000 r-xp 00000000 08:01 3965649 /lib/tls/i686/cmov/<a href="http://libc-2.7.so">libc-2.7.so</a><br>b7cd0000-b7cd1000 r--p 00149000 08:01 3965649 /lib/tls/i686/cmov/<a href="http://libc-2.7.so">libc-2.7.so</a><br>
b7cd1000-b7cd3000 rw-p 0014a000 08:01 3965649 /lib/tls/i686/cmov/<a href="http://libc-2.7.so">libc-2.7.so</a><br>b7cd3000-b7cd7000 rw-p b7cd3000 00:00 0 <br>b7cd7000-b7ce1000 r-xp 00000000 08:01 3932228 /lib/libgcc_s.so.1<br>
b7ce1000-b7ce2000 rw-p 0000a000 08:01 3932228 /lib/libgcc_s.so.1<br>b7ce2000-b7d05000 r-xp 00000000 08:01 3965653 /lib/tls/i686/cmov/<a href="http://libm-2.7.so">libm-2.7.so</a><br>b7d05000-b7d07000 rw-p 00023000 08:01 3965653 /lib/tls/i686/cmov/<a href="http://libm-2.7.so">libm-2.7.so</a><br>
b7d07000-b7d5d000 r-xp 00000000 08:01 1165274 /usr/lib/libsndfile.so.1.0.17<br>b7d5d000-b7d5e000 rw-p 00056000 08:01 1165274 /usr/lib/libsndfile.so.1.0.17<br>b7d5e000-b7d63000 rw-p b7d5e000 00:00 0 <br>b7d63000-b7d65000 r-xp 00000000 08:01 3965652 /lib/tls/i686/cmov/<a href="http://libdl-2.7.so">libdl-2.7.so</a><br>
b7d65000-b7d67000 rw-p 00001000 08:01 3965652 /lib/tls/i686/cmov/<a href="http://libdl-2.7.so">libdl-2.7.so</a><br>b7d67000-b7e4f000 r-xp 00000000 08:01 1164012 /usr/lib/libstdc++.so.6.0.9<br>b7e4f000-b7e52000 r--p 000e8000 08:01 1164012 /usr/lib/libstdc++.so.6.0.9<br>
b7e52000-b7e54000 rw-p 000eb000 08:01 1164012 /usr/lib/libstdc++.so.6.0.9<br>b7e54000-b7e5a000 rw-p b7e54000 00:00 0 <br>b7e5a000-b7f19000 r-xp 00000000 08:01 1165782 /usr/lib/libasound.so.2.0.0<br>b7f19000-b7f1d000 rw-p 000be000 08:01 1165782 /usr/lib/libasound.so.2.0.0<br>
b7f1d000-b7f1e000 rw-p b7f1d000 00:00 0 <br>b7f2b000-b7f2c000 rw-s 81000000 00:0e 11361 /dev/snd/pcmC0D0c<br>b7f2c000-b7f2d000 r--s 80000000 00:0e 11361 /dev/snd/pcmC0D0c<br>b7f2d000-b7f2e000 rw-s 81000000 00:0e 11354 /dev/snd/pcmC0D0p<br>
b7f2e000-b7f2f000 r--s 80000000 00:0e 11354 /dev/snd/pcmC0D0p<br>b7f2f000-b7f30000 rw-p b7f2f000 00:00 0 <br>b7f30000-b7f31000 r-xp b7f30000 00:00 0 [vdso]<br>b7f31000-b7f4b000 r-xp 00000000 08:01 3932197 /lib/<a href="http://ld-2.7.so">ld-2.7.so</a><br>
b7f4b000-b7f4d000 rw-p 00019000 08:01 3932197 /lib/<a href="http://ld-2.7.so">ld-2.7.so</a><br>bfbe3000-bfbf8000 rw-p bffeb000 00:00 0 [stack]<br>Aborted<br><br>--------------------------end paste------------------------<br>
<br></div></div></div>