A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: garbage collecting

  1. #1
    Senior Member
    Join Date
    Jul 2008
    Posts
    418

    garbage collecting

    when you have an object 1that has another object2, and that object2 has a reference to object1, will they never be garbage collected? how do you remove them if you have this?

  2. #2
    Senior Member Danskeren's Avatar
    Join Date
    Jan 2004
    Posts
    263
    Even though you have two objects pointing to each other, if there are no pointers leading to one of the objects, starting from the main thread, then the garbage collector will (should) discover this and remove the objects.

    A link for GC in flash 8: http://www.kaourantin.net/2005/09/ga...-player-8.html
    Possibilities are only limited by the lack of creativity...
    www.Ryer.dk
    www.ArrayPainter.com
    www.PawnStar.net

  3. #3
    Senior Member
    Join Date
    Jul 2008
    Posts
    418
    so the references have to be from the document class, down? so if the main class doesn't have a reference to something that has a reference to some object thet object will be destroyed, no matter how many references it has?

    are you sure?

  4. #4
    Senior Member Danskeren's Avatar
    Join Date
    Jan 2004
    Posts
    263
    Yes. In theory the garbage collector removes all objects than cant be traced from the main thred through references (No matter how many). Reality can sometimes be a little different, cause a garbage collector is no easy task implementing which means that errors may occure (and errors does occure). But as a flash programmer you should just make sure to erase the pointers for the objects, which you want to remove and pray for the rest
    Possibilities are only limited by the lack of creativity...
    www.Ryer.dk
    www.ArrayPainter.com
    www.PawnStar.net

  5. #5
    Senior Member
    Join Date
    Jul 2008
    Posts
    418
    so i have to destroy the links between objects no matter what?

    what do you mean a garbage collector is no easy task implementing? do you mean for the people that made flash, or for me?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center