How do you know it is not being garbage collected? If you keep a reference to 
it, it won't be marked as garbage. 

How are you trying to "remove" the rotator?

I can also see how you might have two rotators that conflict, since in some places you reference 
the "node" argument that was passed in (via the "photoContainer" var) and in 
some places you just grab the container by ID ($('#photo-container.final .outgoing').css(...)). 
These might not always be the same element and if you had two Rotators, they'd both be trying to 
manipulate #photo-container at the same time.

Finally, there are places where you are trying to delete variables declared 
with the var keyword inside a function, e.g:

        var placeFirstImage = function(firstImage) {
            $('#photo-container').append(firstImage);
            outgoingImage = photoContainer.children(0);
            delete placeFirstImage;
        };

That actually doesn't work—using the delete operator on variables declared this 
way will always fail. You can read up a bit more on how delete actually works 
here: http://perfectionkills.com/understanding-delete/

Since it's not completely clear exactly what the problem you're seeing is, I 
hope some of this gets you moving in the right direction.

-Rob


On Feb 28, 2011, at 10:32 PM, Brian Earwood <[email protected]> wrote:

Hi everyone,

I'm having a good bit of trouble removing one of my objects from my site.

I have an image rotator class that gets created every time a visitor wants to 
view a new image gallery. The new one gets created fine but the old one never 
goes away, no matter how many deletes and nulls I set everything to.

I hate to post a whole class to look at but I'm a bit stuck here.
Could you check out what my Rotator class looks like and let me know if you see 
any glaring errors that would cause it to not be marked for garbage collection:
http://jsfiddle.net/brianearwood/nMurj/

Or if not, I could use some good resources on the matter.

Thanks for you help!

Brian

--
To view archived discussions from the original JSMentors Mailman list: 
[email protected]/'>http://www.mail-archive.com/[email protected]/

To search via a non-Google archive, visit here: 
[email protected]/'>http://www.mail-archive.com/[email protected]/

To unsubscribe from this group, send email to
[email protected]

--
To view archived discussions from the original JSMentors Mailman list: 
http://www.mail-archive.com/[email protected]/

To search via a non-Google archive, visit here: 
http://www.mail-archive.com/[email protected]/

To unsubscribe from this group, send email to
[email protected]

Reply via email to