|
-
Señor Member
Remove from Vector... will it be gc'd?
Hi, I'm creating a simulation in which a large number of objects are added to vectors and then taken away in random order (as more are being added).
To remove the objects, I splice the object from the vector it's in, and notify all the other objects that an object ahead of them was removed so they can change their indices accordingly.
As far as I know, the objects have no other references (I think), and within the object, I set everything to null. I read somewhere that you can't put "delete this" in the class, so I didn't bother with that.
Will this be sufficient to get the object garbage collected, or should I do something else? What are the best ways to get something like this garbage collected?
Thanks,
Mavrisa
Haikus are easy
But sometimes they don't make sense
Refrigerator
-
Senior Member
As long as they aren't display objects on the chain and there aren't any other ref's, collection should kick in almost immediately when they're spliced from the vector. If there's any question, refer to this thread:
http://board.flashkit.com/board/show...t=active+graph
I posted the code for a good class called ActiveGraph there (not written by me) that's useful for testing whether you're getting collection. Read the thread for details about how to use it...
-
Señor Member
Awesome! thanks
Haikus are easy
But sometimes they don't make sense
Refrigerator
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|