If by garbage collection you mean real-time, then no. Most browsers will cleanup pretty thoroughly when you refresh or load a new page, but in the scope of a single page there is very little GC.  Try this page that I setup a few weeks ago to test various Event handling libraries: (disable Firebug for most consistent results)
http://colin.mollenhour.com/events/test.html?rev=hybrid

Open Task Manager or whatever memory monitoring tool you use and click "Create Elements", now click "Make ToolTips". Ok, memory usage went up quite a bit. Now click "Cleanup" and then "Clear". Memory usage probably didn't go down, but that isn't leaked memory it is just memory that seems to be allocated to that page still, because if you repeat the above steps again it won't go up any more this time.  Now reload the page and you're back to what you started with roughly. However, if you repeat the above steps two or more times but forgetting to click "Cleanup", the memory usage for that page will go up more each time. You'll still get it all back when you reload the page again, but that is what I'm referring to when I say memory leaks.  For many sites it isn't so critical because they may have a shorter lifetime or simply not much memory usage to begin with, but I try to design everything in such a way that it would scale in the worst of circumstances.

Your original problem was non-unique ids.. you were copying the innerHTML of a node that contained another node with an id specified so it was trying to create a second node with the same id. I think FF and IE handle this differently but it would have cropped up as a problem in FF eventually as well.

Colin


David Welton wrote:
On 2/27/07, Colin Mollenhour <[EMAIL PROTECTED]> wrote:

Hi, thanks for your extensive response!

  
I think you should try to design this system more in _javascript_ and less
in HTML.
    

Yes, I suppose you're right.  I have everything working quite nicely
with Rails, but it uses a more direct, brutal 'replace everything and
set up new drag/drops' each time, which isn't taking full advantage of
JS.

  
I.e. Store your draggables in a cache somewhere and add and
remove them via pure JS, not using embedded script tags.
This may not do *exaclty* what you're trying to do but it is a (very
good) start:
    

It is indeed - thanks!

  
There are likely some bugs in that code as I typed it all into
Thunderbird just now ;)
Using something like this to handle all of your draggable
creation/destruction will make things much easier, not to mention this
actually does proper cleanup whereas before your were leaking memory
each time you created a new one over the top of an old one.
    

I'm curious about the 'leaking memory' thing... isn't this stuff
GC'ed?  Or are FF and IE bad at that?  I'm pretty used to dynamic
languages just taking care of stuff when it's not referenced by
anything else.

Just out of curiousity, does anyone know what the limitations are in
IE that are causing the original problem I mentioned?

Thankyou,
  

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to