spock@ihlpf.ATT.COM (Weiss) (09/15/88)
I've run out of memory in NeWS a couple of times when I've been playing with lots of canvases with lots of subcanvases. Each canvas also has a process looking for events. I'm wondering how to make sure that these canvases are garbage collected. A possible list of things to do to insure that canvases are garbage collected: 1.) Remove all references to the canvas in my dictionaries 2.) Unmap the canvas 3.) Destroy all processes awaiting events for the canvas Is this necessary and sufficient? Can I just unmap a parent canvas and forget about the children? Do I need to turn off retained? I am running 3.4 and 4.0 with NeWS 1.1. -- Ed Weiss "I thought it was generally accepted, sir, that att!ihlpf!spock vulcans are an advanced and most honorable race." "They are, they are. And damn annoying at times."
mh@wlbr.EATON.COM (Mike Hoegeman) (09/17/88)
In article <6149@ihlpf.ATT.COM> spock@ihlpf.UUCP (Ed-Weiss) writes: >I've run out of memory in NeWS a couple of times when I've >been playing with lots of canvases with lots of subcanvases. >Each canvas also has a process looking for events. I'm wondering >how to make sure that these canvases are garbage collected. >A possible list of things to do to insure that canvases are >garbage collected: > 1.) Remove all references to the canvas in my dictionaries > 2.) Unmap the canvas > 3.) Destroy all processes awaiting events for the canvas >Is this necessary and sufficient? Can I just unmap a parent canvas >and forget about the children? Do I need to turn off retained? Usually, just unmapping a parent canvas does'nt hack it. If your canvases are retained it probably does almost nothing as far as reclaiming memory goes. To ensure you are gc'ing everything under a parent canvas start a new process group for your parent canvas environment using newprocessgroup , then when you want to blast everything associated with that parent recursively from the parent down do a revokeinterest on the list of interests contained in each canvas . these are contained under the /Interests (sic?) key of the canvas dict. then do a killprocessgroup Unless you're doing something really wierd this cleans up stuff pretty good. If you cannot do a killprocessgroup from some reason you might want to stick in each canvas the process id for the event mgr associated with it as you start it up. Then when it comes time to clean up you can just recurse down from your parent canvas merrily killing the eventmgr processes with killprocess as you go downwards. If you put stuff in systemdict you gotta clean it up yourself by doing something like systemdict /thingie undef. I think in the NeWS manual near the start they have a little blurb that talks about how stuff gets garbage collected. worth checking out. Hope this helps. -mike