[plt-scheme] Snips and editors not garbage collected after copying to clipboard

From: Agnes Schemelt (highflyer451 at hotmail.com)
Date: Tue Apr 15 17:10:03 EDT 2003

Hi, all:

I don't know if this issue has been brought up already, but since it shows 
up in version 203, it seems not to have been addressed: when I copy a snip 
to the clipboard, that copy NEVER gets garbage collected, even if I never 
paste it.

I discovered this while playing around with the decorated-snip%'s (such as 
the XML or Splice box) that are available in DrScheme's definition window. I 
would create a box, fill it will a lot of text, and repeatedly copy the box 
to the clipboard (without pasting). Since it's never used, you would think 
that intermediate objects would disappear, but they don't. Every time a snip 
is copied to the clipboard (even without pasting), the value of 
"(current-memory-use)" always goes up.

I also confirmed this by looking at memory usage in my Windows Task Manager.

I furthermore confirmed that these intermediate objects don't get GC'ed by 
placing every instance under a will executor: the executor never gets 

This behavior also shows up in MrEd, outside of the DrScheme framework.


This leads to another question: Why does a decorated-snip's (or any snip's) 
"copy" method create another instance of the snip in order to write out its 
structure to the clipboard? Why not use the current snip? Compounding this, 
when pasting, another copy of the snip gets created again. Why so much 
needless copying?

Perhaps it's a problem with just decorated-snip's. Yet when I create a snip 
where its "copy" method uses its current instance to write to the clipboard, 
I end up corrupting the editor stream when I paste.


Overall, though, I give you developers the highest praises for the MrEd 
framework, and the graphical toolbox in particular. The whole system has 
allowed me to create a wonderfully useful application. I want to help to 
improve it.

I'm very familiar now with the C++ code in the mred/src directory, so you 
can refer me to it if you want to point things out.


-- Agnes

The new MSN 8: advanced junk mail protection and 2 months FREE*  

Posted on the users mailing list.