2010/9/6 Tambet
Hi again!
Hey Tambet!
As Chuck lacks garbage collection,
Well.... There is a partially implemented garbage collector, based on reference counting. Sometimes it works, sometimes it doesn't, sometimes it's count is off and objects disappear. Primitives (like int, float....) should be freed once their scope seizes to exist.
it's probably The language, which needs a manual about garbage collection - I mean, a manual about lack of it.
Maybe, What we need is GC to be finished, then documented. First of all; given a more or less typical modern system CPU cost will be a much bigger bottleneck than memory. Unchuck UGens you no longer need from their connection to the dac and/or blackhole and they won't take cpu any more. Have unused Shreds exit or simply reach the end of their code. If you really want to manually remove objects you no longer need you can do this; null @=> my_object; That should force it to be collected. I'm not sure that also affects UGens but I am sure (as I just tested) that this won't affect currently connected UGens.
Googling "chuck programming garbage collection" gives these pages:
- The Ultimate Top 25 Chuck Norris “The Programmer” Jokes - Chuck Esterbrook: Geek of the Week - Java Programming - Hump Day OT
Yes, this is a rather arcane field. GC is turning out to be harder than anticipated, or so it seems.
It would be good to know, how much memory things take, how to keep memory from growing full etc.
On Unix you can run "top" or some recourse monitor that you may have. On Windows there's the task manager which should show how much memory you are using. In practice I've only once seen this come close to becoming a issue and that involved non-realtime rendering of a ray-tracing reverb which in one (misguided) design used tens of thousands of shreds. If this become a real issue that you actually have we could look at your code and see what optimizations could be made. Don't get me wrong; we do need GC and leaks will be a issue for applications like installations that need to run unattended for a long time using many samples, but for most applications on a system build in the past 5 years you should be fine.
For example - if I close something, will it release memory?
Could you give a example of closing something? I'm not sure what you mean. Yours, Kas.