hello everyone,
I have been trying to solve this problem for over 3 days already. At first
I was noticing sluggish performance through my webapp after several
rounds of sortable.create. I start to suspect that sortable.destroy
does not release and unregister all event observers. Therefore I
used a test case of iterating through a series of sortable.create
and sortable.destroy. I noticed a slight increase of memory usage, but
the memory is released as soon as I refresh the page.
As for my webapp, at any given time when a sortable is modified, an
ajax request is sent to replace the innerhtml of that sortable. Before
refreshing the old content of sortable div, I call sortable.destroy() to
make sure everything gets unregistered. After ajaxing the content of
the sortable, I then call Sortable.create() to re-register all the child
elements.
This all works, but the memory usage increases dramatically(.5 -1 meg) as I
recreate the sortable each time. I can easily go over 150 meg of memory
usage just by dragging around items. The memory never gets released (even if
I refresh the page).
To my surprise this dramatic increase of memory usage only happens in IE.
My sortable list is not big at all(~around 10 items). I''m not using any
tree
options.
I suspect circular reference or closures might exist inside the
dragdrop.jsthat''s
causing this memory leak.
I provided some simple sample test case code below to show you guys what
I''m
talking about.
//first call to create sortable
function createSortable(){
Sortable.create
(''sortableDiv'',{tag:''div'',dropOnEmpty:true,containment:[''sortableDiv''],only:''lineItem'',onUpdate:sendAjaxRequest});
}
//called by onupdate
function sendAjaxRequest(element){
var sequence =Sortable.sequence(element);
ajaxEngine.sendRequest
(''server'',''action=updateSortableDiv'',''sequence=''+sequence);
}
//when response is received
function processResponse(){
Sortable.destroy(''sortableDiv'');
//some code here to refresh sortableDiv element update by replacing
innerhtml
//recreate sortable for ''sortableDiv''
createSortable();
}
--~--~---------~--~----~------------~-------~--~----~
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
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---