Injector's m_attendedToInjectees keeps objects alive

Tomas Mirezko's Avatar

Tomas Mirezko

14 Jul, 2011 07:23 PM

Hello robots!

I have a problem with Flash Player's GC. My app consits of MainContext, which loads ChildContext and inject's it's injector as parentInjector using Joel's Modular utility. Source codes are in attachement.


Mediator which was injected into is inserted into m_attendedToInjectees Dictionary(true) in SwiftSuspendersInjector and it is not disposed after other references are lost. Click top left button to unload ChildContext and watch objects from com.cuketa.test.profilerissue.child package not dispose because of some mysterious references.

I am using Flash Builder 4.5.1 Profiler to see references and there is only to reference to m_attendedToInjectees Dictionary.

1) is m_attendedToInjectees needed or useful in some way? or can I remove it safely?
2) What other object could hold reference to this object and not show up in FB Profiler?
3) Is it possible that weak-keyed Dictionary is not releasing it's key correctly?

  1. 1 Posted by Weyert de Boer on 15 Jul, 2011 12:57 AM

    Weyert de Boer's Avatar

    Hmm, I thought I wrote a reply :(

  2. 2 Posted by Weyert de Boer on 15 Jul, 2011 12:59 AM

    Weyert de Boer's Avatar

    A screenshot of my Flash Builder not showing any instances of child context. Also when I execute "Find loitering objects" after creating a memory snapshot before and after click on the button. I only have two items left "Class" and "Object"

  3. 3 Posted by Tomas Mirezko on 15 Jul, 2011 07:45 AM

    Tomas Mirezko's Avatar

    Curious.... we have 3 Windows machines here with 2x Flash Builder 4.5 and 1x Flash Builder 4.5.1 and noone can get your results.

    Can somebody with Windows try this as well, please?

  4. 4 Posted by Tomas Mirezko on 15 Jul, 2011 08:04 AM

    Tomas Mirezko's Avatar

    Lost message:

    From: Weyert
    Subject: Injector's m_attendedToInjectees keeps objects alive

    Where do you see this? If I compile your project and then make a memory snapshot before pressing the button and one after pressing the button. After a bit of waiting in between of course! Anyways, if I know do a "Find loitering objects" only two items are listed are Class and Object referring to IDisposable.

    Also if I check Live References it doesn't have any instances of ChildContext, ChildSpriteMediator, ChildSprite etc.

    I am unable to reproduce your GC Root reference for the ChildSpriteMediator.

    View this Discussion online:
    - Screen_shot_2011-07-15_at_02.49.43.png

  5. 5 Posted by Weyert on 15 Jul, 2011 09:07 AM

    Weyert's Avatar

    Thanks Tomas. Did you also try it with memory snapshots? That forces garbage collection.

    I will give it a try on my Windows workstation during my lunch break

  6. 6 Posted by Tomas Mirezko on 15 Jul, 2011 09:34 AM

    Tomas Mirezko's Avatar

    These are my steps to reproduce:

    • start Profiler in Flash Builder 4.5.1 Standalone for Windows in Flash Player 10.3 Debugger (flashplayer_10_3_sa_debug.exe)
    • Configure Profiler

    configure profiler

    • Take memory snapshot
    • click "dispose child module" button
    • Run Garbage Collector
    • Take Memory Snapshot


  7. 7 Posted by Tomas Mirezko on 15 Jul, 2011 10:47 AM

    Tomas Mirezko's Avatar

    Issue solved

    Flash Player Debugger 10.3 or 10.2 has some issue in GC.

    I tested it in AIR 2.7 and Flash Player 11 Beta Debugger and objects are disposed as they should.

  8. 8 Posted by Weyert on 15 Jul, 2011 10:51 AM

    Weyert's Avatar

    Aah, I used the standalone player of 10.2. Maybe that's the difference.

  9. Tomas Mirezko closed this discussion on 15 Jul, 2011 02:50 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac