0 Replies Latest reply on Dec 10, 2009 1:57 PM by kkohlstedt

    flash.sampler question

    kkohlstedt

      Has anyone had much experience with the flash.sampler package.  It looks interesting and potentially quite powerful but I have a few questions.

       

      Specifically I'm trying to figure out a way to get my application to dump counts for all of the active objects in memory at a given time.  So that it would display something like

       

      String 50

      Number 20

      CustomObject 10

       

      etc...

       


      Looking at flash.sampler startSampling and getSamples it initially looks like I would be able to startSampling and then when I want to do the dump I could call getSamples to get all objects that are in memory.  The problem of course with this approach is that getSamples will return all objects that were created during the sampling period, not just those that are still in memory.  So, it seems like I could create something that tracks all objects that get created but I don't see a way to keep track of those that get cleaned up.

       

      What would be ideal is a method that I could call that would give me all the live objects in memory.  However I don't see such that such a method exists.  So, is there some way that I would need to manage the results of multiple calls to getSamples and keep track myself of which are still live?  I don't see anyway to figure out when an object is GC'd so there is no obvious way to know which objects are still live.

       

      Any ideas?  If the flex profiler was really implemented using this API, any ideas how they implemented the ability to display live object counts?

       

       

       

      Thanks in advance.