Singletons are a horrible design pattern and the fact that they're poorly implemented in as3 should steer you away from using them there.
Sent from my iPhone On Sep 20, 2013, at 9:48 AM, "Paul A." <p...@ipauland.com> wrote: > What if you make the const a var? > > I don't build my singletons with an initialiser, but whether that makes any > difference, who knows? > > I always make my singleton references explicit, ClassName.getInstance() and > instantiate the instance in getInstance(). > > On 20/09/2013 14:18, ktu wrote: >> anybody have any ideas? >> this is still shaking my boots. >> >> thanks :) >> >> >> On Mon, Sep 16, 2013 at 5:53 PM, ktu <ktu_fl...@cataclysmicrewind.com>wrote: >> >>> hey all! >>> >>> I'm faced with an interesting question. >>> >>> in my codebase, we made the decision to use a few singletons. to implement >>> those singletons we used the static const trick: >>> >>> package com.example { >>> public static const API:AppAPI = new AppAPI(); >>> } >>> >>> package com.example { >>> public class AppAPI { >>> public function AppAPI () { >>> if (API) throw new Error(); >>> } >>> } >>> >>> this works fine in the normal environment we run in. that is, we run in a >>> scheduler system that loads the flash player, runs our swf, then shuts down >>> the flash player, doing that over and over again based off the schedule of >>> content. the problem now is that a new client uses a scheduler that is >>> built on AIR, so the flash player instance never shuts down. whenever our >>> app comes up in the scheduler, memory jumps and never goes down causing the >>> AIR app to crash every couple of hours. If, they load my application only >>> once, and leave it running, it lasts for days without any major memory >>> leaks. >>> >>> any idea how i could test whether GC does pick this up or could? or any >>> known issues with this trick and GC? maybe you just have tricks in general >>> to finding out what GC isn't getting? >>> >>> thanks!!! >>> >>> -- >>> Ktu; >>> >>> The information contained in this message may or may not be privileged >>> and/or confidential. If you are NOT the intended recipient, >>> congratulations, you got mail! > > _______________________________________________ > Flashcoders mailing list > Flashcoders@chattyfig.figleaf.com > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders _______________________________________________ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders