my Problem is completely different.
I try to implement an empty popup and all works fine.
while testing these i recognize the follwoing behavior:
a datagrid is ,at this time the, the one and only component in my module.
if i click in the grid (selecting a row) or typing something with the keyboard in NIL while the grid has the focus, my module is unloading but never garbarge collected. if i set the grid to enabled = false, all works fine!
i try to set the id of my grid to null, befor unload the module, but nothing changes.
do you have a hint for me, how can i delete all referneces, so my unloaded modules will be garbage collected?
you can also see the behavior in the zip-File. All works fine, until you click in the dg. After a click, the simpleModule won't be garbargeCollected (the instance don't go back to 0).
thanks in advanced
ModuleManagerDemo.zip 15.0 K
wow someone answered. Thank you!
Believe it or not, after my first post, i found your blog and did my tests.
so i create the minimal example from chafic kazoun (oreilly) and add a datagrid to the simple module.
do you try the minimal example with a profiler and can you see my problem?
i try to find out, what you mean with "use the profiler and see what is holding a reference.
can you give me a deeper explanation?
i'm not sure, if your blog fit exactly, because:
my module was defently unload
brings true and false on the screen.
But a instance hangs in the profiler. when i'm load the module again click on the grind and unload it, the reference goes from 2 to 1. Now i'm load the module again, klick on the grid and typing some letters with the keyboard, unload the module, the instance hangs now on 2. doing the same, the instance fell from 3 to 2. i assume, that keyboard and mouse inputs create some references.
can you please try my example and find out, whats goes here wrong?
i'm confusing about the last lines in your blog. a debug-version can cause some pins modules and a shold try it with an release version without an FP debugger. But without these i'm unable to check, if an instance hang in memory.
I won't have time to try your example any time soon. Which version of Flex are you using? Make sure you're on the latest.
moduleInfo's loaded property simply reflects whether it has released its reference. Any other references will still pin it. The profiler will show that.
There is a post on my blog about unloading modules and it says that the last focused thing can get pinned in memory, and new classes not in the main app will get pinned by the StyleManager. If you don't have DataGrid in the main app and put it in the module, the first load of the module will get pinned.
To test with the release player, write a timer loop that loads and unloads the modules every few seconds and let it run overnight. It'll crash if memory continues to leak.
Flex SDK Developer
Adobe Systems Inc.
thank you again.
I'm trying to get the information as you said:
"moduleInfo's loaded property simply reflects whether it has released its reference. Any other references will still pin it. The profiler will show that."
can you give me a hint, how can i get this information.
After pinning my module on memory caused by click on dg, the simpleModule will be shown in the loitering objects and i can see (48) behind it. but it's hard for me to find the references created by frameword or creatd by me.
My flex-version is 3.2.0, imho the latest version.
i read your post and work through, so, before i unload my module by button in mainapplication, i set the focus per "focusManager.setFocus(loadBtn);" away from my module. Also, i placed a dg on my mainApp with a dataProvider. Both won't fix my problem. in my example, there is no styles defined at all.
i think, i haver to get the information from profiler, which reference pin my module inmemory, but i'm unable to locate it at this time.
The unloading works fine until i click on the dg or typing in some letters. Imho, there must be a procedure that will pin the module after getting some buttonDownEvents (or something else). But i'm not so deep in the framework to figure out the procedure for my self.....
Can you give me further information, please.
thank you for your helpful answers. unfortunately i found no solution for my problem.
i found in your blog a workshop for detecting leaks with profiler. i really work hard but i didn't found a single id. All ids are listet again in an upper node. So, as you describe, thats not the objects who cause the leak.
i also find the 3.4SDK and update my system. but nothing changes.
if i have in the example a huge application with a lot of timers, listeners and so one, i would say, that i did an error.
But in my minimal-example nothing of these tihngs are implemented.
Either, there is a bug (after a few tests, button, chackbox, radioButton, label cause no error, textInput and datagrid cause the error, but textInput inherit from UIComponent and datagrid from ListBase / DataGridBase, while a button inherit also from UIComponent and cause no error.) or i did a generall failure.
The failure appears after clicking or typing into the component while the component has the focus. Is there anything, wich i should generally unregister?
i can't believe it.
my problem is solved with the sdk 3.4. Switching back to 3.2, the problem comes back!.
the module is removed after clicking into the datagrid.
but, if i typing something in, the module will be removed until i typing a letter somewhere into the application. can i control this beavior by code?
You can try setting focus somewhere else in the app, but it might be the player issue described in the post about unloading modules. The profiler can help you figure it out.
Flex SDK Developer
Adobe Systems Inc.