j.c.wichman schrieb:
Hi Roman,
You describe my_var =null as being useless, but this should be enough for
the garbage collector to come along and reclaim an object?
With respect to the static issue, what do you mean with 'static instances' ?
Could u provide an example of such an object with isn't reclaimed?
Sorry, not at hand. I remember my first use of static values (NOT instances, of course - excuse me if I said so, that's dumb of course) with a gaming app, where I made a sokoban-style game within the whole thing. This sokoban game was an instance of my sokoban-class, using _some_ static values. After the sokoban was over, the game mc has been removed (removeMovieClip) and loaded anew when the player wanted to play another round. The times after the first run gave me the headaches, until I stopped using _any_ static value in my class.

Another weird example out of my actual project:

my_loader is an instance of my preloading-manager-class, the array created_clips stores references to the successfully loaded mcs:

At some place - i.e. when stopping the game represented by the mc that has been loaded by my "my_loader" - the game should be removed from memory (for performance reasons):

   my_loader.created_clips[names.game_1].undloadMovie();
   my_loader.created_clips[names.game_1].removeMovieClip();
_root.host.debug("GameHost.gameStop(" + movie_name + "): my_loader.created_clips["+names.game_1+"] == "+my_loader.created_clips[names.game_1]);
   _root.host.debug("GameHost.gameStop(" + movie_name + "):
       typeof(my_loader.created_clips["+names.game_1+"]) ==
       "+typeof(my_loader.created_clips[names.game_1]));

The debug-call (simply directs text to a floating text field for debugging) yields the following:

GameHost.gameStop(IcefallClimbing): my_loader.created_clips[IcefallClimbing] == _level0.gamecontainer.IcefallClimbing GameHost.gameStop(IcefallClimbing): typeof(my_loader.created_clips[IcefallClimbing]) == movieclip


So you really should digest this: The loaded mc is first unloaded, then removed, and still it sits there in memory as a moveclip! I'm seeing ghosts....

When I - after unloding and removing -

   delete my_loader.created_clips[names.game_1];

then of course my debug states it is "null", but I'm not really sure, whether it really is null, or whether there simply isn't any variable left that could point to my unloaded and then removed movieclip still residing in memory...

Unfortunately I'm not really wondering whether it's a bug or a feature - it's special, it's Flash.


Best regards,
Roman.

--

-------------------------------------------------------------------
gosub communications gmbh | fredersdorfer str. 10  | 10243 berlin
t [030] 29 66 88 81 | f [030] 29 66 88 84 | http://www.gosub.de
-------------------------------------------------------------------

_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to