RE: [flexcoders] Re: Tools for listing objects

2006-07-28 Thread Matt Chotin












Using a dictionary isnt completely
reliable because the garbage collector will only free up what it needs. If the
window isnt taking too much space the collector may not go ahead and
clean it up for a while. The weak reference only says take it if you
need it but its not guaranteed that if the only reference is weak
that it will disappear immediately. Thats why we trigger garbage
collection by creating a bunch of objects, its to force the GC into
thinking it needs the space for allocation.



Matt











From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of jeff tapper
Sent: Thursday, July 27, 2006 9:41
AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: Tools
for listing objects











Really, what im looking for, is some way to check if
an object no 
longer exists. I thought a weak reference in the dictionary might 
work for me, but after 14 hours of inactivity, those weak references 
are still there. 

Am i misunderstanding the nature of a weak reference? Is there some 
other way that I can test to see if a given object still exists?

--- In [EMAIL PROTECTED]ups.com,
Matt Chotin [EMAIL PROTECTED] wrote:

 There's no way to know if garbage collection was forced. Create a
 method does does a for loop that creates 10,000 objects into mid-
air.
 
 
 
 For (var i:int=0; I  1; i++)
 
 New Object();
 
 
 
 That should trigger the garbage collector hopefully.
 
 
 
 
 
 From: [EMAIL PROTECTED]ups.com

[mailto:[EMAIL PROTECTED]ups.com]
On
 Behalf Of jeff tapper
 Sent: Thursday, July 27, 2006 5:56 AM
 To: [EMAIL PROTECTED]ups.com
 Subject: [flexcoders] Re: Tools for listing objects
 
 
 
 Well, that experiment failed as well. 14 hours later, the same 
 objects are still listed in the dictionary.
 Wed Jul 26 17:07:23 GMT-0400 2006
 Testing56:Testing56
 Testing19:Testing19
 Testing38:Testing38
 Thu Jul 27 08:50:31 GMT-0400 2006
 Testing56:Testing56
 Testing19:Testing19
 Testing38:Testing38
 
 Am I misunderstanding the usage of Weak References in the 
 Dictionary? Does anyone have any idea how this can be used to keep 
 track of what objects exist and which dont?
 
 --- In [EMAIL PROTECTED]ups.com
mailto:flexcoders%
40yahoogroups.com
 , jeff tapper jeff@ wrote:
 
  Ok, heres a sketch of what im trying now. 
  App.mxml
  
  ?xml version=1.0 encoding=utf-8?
  mx:Application xmlns:mx=http://www.adobe.com/2006/mxml
 http://www.adobe.com/2006/mxml
 
  layout=vertical creationComplete=initApp()
  mx:Script
  ![CDATA[
  import mx.managers.PopUpManager;
  import mx.managers.PopUpManagerChildList;
  import mx.core.IFlexDisplayObject;
  private var screenDict:Dictionary;
  private var scr1:IFlexDisplayObject;
  private function initApp():void{
  screenDict = new Dictionary(true);
  }
  public function createScreen
  (parent:DisplayObjectContainer, 
  screen:Class,modal:Boolean=false):IFlexDisplayObject{
  var s:IFlexDisplayObject = 
  PopUpManager.createPopUp(parent, screen, 
  modal,PopUpManagerChildList.APPLICATION);
  screenDict[s] = s.name
  return s;
  }
  public function showObjects():void{
  trace(new Date());
  for (var i:* in screenDict){
  trace(i+:+screenDict[i]);
  }
  }
  public function removeScreen
  (screen:IFlexDisplayObject):void{
  PopUpManager.removePopUp(screen);
  }
  private function makeScreen():void{
  if(scr1 == null){ 
  scr1 = createScreen
  (this,Testing,false);
  }
  }
  private function destroyScreen():void{
  removeScreen(scr1);
  scr1 = null;
  }
  
  ]]
  /mx:Script
  mx:Button click=makeScreen() label=make/
  mx:Button click=destroyScreen() label=kill/
  mx:Button click=showObjects() label=show/
  /mx:Application
  
  Testing.mxml
  =
  ?xml version=1.0 encoding=utf-8?
  mx:Panel xmlns:mx=http://www.adobe.com/2006/mxml
 http://www.adobe.com/2006/mxml
 width=400 
  height=300
  mx:Button click=this.dispatchEvent(new
Event('foo'))/
  /mx:Panel
  
  Now, as i run this, if i click make, kill, make, kill, show, The 
  trace shows:
  Wed Jul 26 17:07:14 GMT-0400 2006
  Testing58:Testing58
  Testing20:Testing20
  Testing39:Testing39
  
  Implying that the screens arent really being destroyed. Perhaps 
I 
  didnt wait long enough, so 5 minutes later, I tried the same 
 thing, 
  with the same results. Maybe 5 minutes isnt long enough, so I'll 
  leave it running over night and try again in the morning. But, 
 the 
  fundemental question is, have i done enough to remove the 
 screens? 
  Should the garbage collector clean the unused ones up, or have i 
  somehow left a reference lingering?
  
  We have a very complex app, which I want to ensure we clean up 
all 
  unused objects, but im having trouble finding a way to verify 
they 
  are removed.
 







__._,_.___





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com








   






  
  
SPONSORED LINKS

[flexcoders] Re: Tools for listing objects

2006-07-28 Thread jeff tapper
Ok, I get it.  So, if i were to write a method which forced a bunch 
of anonymouse objects to be created, the GC should fire, and i 
should be able to tell if it worked?  Let me give that a try.

--- In flexcoders@yahoogroups.com, Matt Chotin [EMAIL PROTECTED] wrote:

 Using a dictionary isn't completely reliable because the garbage
 collector will only free up what it needs.  If the window isn't 
taking
 too much space the collector may not go ahead and clean it up for a
 while.  The weak reference only says take it if you need it but 
it's
 not guaranteed that if the only reference is weak that it will 
disappear
 immediately.  That's why we trigger garbage collection by creating 
a
 bunch of objects, it's to force the GC into thinking it needs the 
space
 for allocation.
 
  
 
 Matt
 
  
 
 
 
 From: flexcoders@yahoogroups.com 
[mailto:[EMAIL PROTECTED] On
 Behalf Of jeff tapper
 Sent: Thursday, July 27, 2006 9:41 AM
 To: flexcoders@yahoogroups.com
 Subject: [flexcoders] Re: Tools for listing objects
 
  
 
 Really, what im looking for, is some way to check if an object no 
 longer exists. I thought a weak reference in the dictionary might 
 work for me, but after 14 hours of inactivity, those weak 
references 
 are still there. 
 
 Am i misunderstanding the nature of a weak reference? Is there 
some 
 other way that I can test to see if a given object still exists?
 
 --- In flexcoders@yahoogroups.com mailto:flexcoders%
40yahoogroups.com
 , Matt Chotin mchotin@ wrote:
 
  There's no way to know if garbage collection was forced. Create a
  method does does a for loop that creates 10,000 objects into mid-
 air.
  
  
  
  For (var i:int=0; I  1; i++)
  
  New Object();
  
  
  
  That should trigger the garbage collector hopefully.
  
  
  
  
  
  From: flexcoders@yahoogroups.com mailto:flexcoders%
40yahoogroups.com
 
 [mailto:flexcoders@yahoogroups.com mailto:flexcoders%
40yahoogroups.com
 ] On
  Behalf Of jeff tapper
  Sent: Thursday, July 27, 2006 5:56 AM
  To: flexcoders@yahoogroups.com mailto:flexcoders%
40yahoogroups.com 
  Subject: [flexcoders] Re: Tools for listing objects
  
  
  
  Well, that experiment failed as well. 14 hours later, the same 
  objects are still listed in the dictionary.
  Wed Jul 26 17:07:23 GMT-0400 2006
  Testing56:Testing56
  Testing19:Testing19
  Testing38:Testing38
  Thu Jul 27 08:50:31 GMT-0400 2006
  Testing56:Testing56
  Testing19:Testing19
  Testing38:Testing38
  
  Am I misunderstanding the usage of Weak References in the 
  Dictionary? Does anyone have any idea how this can be used to 
keep 
  track of what objects exist and which dont?
  
  --- In flexcoders@yahoogroups.com
 mailto:flexcoders%40yahoogroups.com  mailto:flexcoders%
 40yahoogroups.com
  , jeff tapper jeff@ wrote:
  
   Ok, heres a sketch of what im trying now. 
   App.mxml
   
   ?xml version=1.0 encoding=utf-8?
   mx:Application xmlns:mx=http://www.adobe.com/2006/mxml
 http://www.adobe.com/2006/mxml 
  http://www.adobe.com/2006/mxml http://www.adobe.com/2006/mxml 
  
   layout=vertical creationComplete=initApp()
   mx:Script
   ![CDATA[
   import mx.managers.PopUpManager;
   import mx.managers.PopUpManagerChildList;
   import mx.core.IFlexDisplayObject;
   private var screenDict:Dictionary;
   private var scr1:IFlexDisplayObject;
   private function initApp():void{
   screenDict = new Dictionary(true);
   }
   public function createScreen
   (parent:DisplayObjectContainer, 
   screen:Class,modal:Boolean=false):IFlexDisplayObject{
   var s:IFlexDisplayObject = 
   PopUpManager.createPopUp(parent, screen, 
   modal,PopUpManagerChildList.APPLICATION);
   screenDict[s] = s.name
   return s;
   }
   public function showObjects():void{
   trace(new Date());
   for (var i:* in screenDict){
   trace(i+:+screenDict[i]);
   }
   }
   public function removeScreen
   (screen:IFlexDisplayObject):void{
   PopUpManager.removePopUp(screen);
   }
   private function makeScreen():void{
   if(scr1 == null){ 
   scr1 = createScreen
   (this,Testing,false);
   }
   }
   private function destroyScreen():void{
   removeScreen(scr1);
   scr1 = null;
   }
   
   ]]
   /mx:Script
   mx:Button click=makeScreen() label=make/
   mx:Button click=destroyScreen() label=kill/
   mx:Button click=showObjects() label=show/
   /mx:Application
   
   Testing.mxml
   =
   ?xml version=1.0 encoding=utf-8?
   mx:Panel xmlns:mx=http://www.adobe.com/2006/mxml
 http://www.adobe.com/2006/mxml 
  http://www.adobe.com/2006/mxml http://www.adobe.com/2006/mxml 
 
 width=400 
   height=300
   mx:Button click=this.dispatchEvent(new Event('foo'))/
   /mx:Panel
   
   Now, as i run this, if i click make, kill, make, kill, show, 
The 
   trace shows:
   Wed Jul 26 17:07:14 GMT-0400 2006
   Testing58:Testing58
   Testing20:Testing20
   Testing39:Testing39
   
   Implying that the screens arent really being destroyed. 
Perhaps 
 I 
   didnt wait long enough, so 5 minutes

[flexcoders] Re: Tools for listing objects

2006-07-27 Thread jeff tapper
Well, that experiment failed as well.  14 hours later, the same 
objects are still listed in the dictionary.
Wed Jul 26 17:07:23 GMT-0400 2006
Testing56:Testing56
Testing19:Testing19
Testing38:Testing38
Thu Jul 27 08:50:31 GMT-0400 2006
Testing56:Testing56
Testing19:Testing19
Testing38:Testing38

Am I misunderstanding the usage of Weak References in the 
Dictionary?  Does anyone have any idea how this can be used to keep 
track of what objects exist and which dont?

--- In flexcoders@yahoogroups.com, jeff tapper [EMAIL PROTECTED] wrote:

 Ok, heres a sketch of what im trying now. 
 App.mxml
 
 ?xml version=1.0 encoding=utf-8?
 mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; 
 layout=vertical creationComplete=initApp()
   mx:Script
   ![CDATA[
   import mx.managers.PopUpManager;
   import mx.managers.PopUpManagerChildList;
   import mx.core.IFlexDisplayObject;
   private var screenDict:Dictionary;
   private var scr1:IFlexDisplayObject;
   private function initApp():void{
   screenDict = new Dictionary(true);
   }
   public function createScreen
 (parent:DisplayObjectContainer, 
 screen:Class,modal:Boolean=false):IFlexDisplayObject{
   var s:IFlexDisplayObject = 
 PopUpManager.createPopUp(parent, screen, 
 modal,PopUpManagerChildList.APPLICATION);
   screenDict[s] = s.name
   return s;
   }
   public function showObjects():void{
   trace(new Date());
   for (var i:* in screenDict){
   trace(i+:+screenDict[i]);
   }
   }
   public function removeScreen
 (screen:IFlexDisplayObject):void{
   PopUpManager.removePopUp(screen);
   }
   private function makeScreen():void{
   if(scr1 == null){   
   scr1 = createScreen
 (this,Testing,false);
   }
   }
   private function destroyScreen():void{
   removeScreen(scr1);
   scr1 = null;
   }
   
   ]]
   /mx:Script
   mx:Button click=makeScreen() label=make/
   mx:Button click=destroyScreen() label=kill/
   mx:Button click=showObjects() label=show/
 /mx:Application
 
 Testing.mxml
 =
 ?xml version=1.0 encoding=utf-8?
 mx:Panel xmlns:mx=http://www.adobe.com/2006/mxml; width=400 
 height=300
   mx:Button click=this.dispatchEvent(new Event('foo'))/
 /mx:Panel
 
 Now, as i run this, if i click make, kill, make, kill, show, The 
 trace shows:
 Wed Jul 26 17:07:14 GMT-0400 2006
 Testing58:Testing58
 Testing20:Testing20
 Testing39:Testing39
 
 Implying that the screens arent really being destroyed.  Perhaps I 
 didnt wait long enough, so 5 minutes later, I tried the same 
thing, 
 with the same results.  Maybe 5 minutes isnt long enough, so I'll 
 leave it running over night and try again in the morning.  But, 
the 
 fundemental question is, have i done enough to remove the 
screens?  
 Should the garbage collector clean the unused ones up, or have i 
 somehow left a reference lingering?
 
 We have a very complex app, which I want to ensure we clean up all 
 unused objects, but im having trouble finding a way to verify they 
 are removed.







--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

* To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/

* To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

* Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
 




Re: [flexcoders] Re: Tools for listing objects

2006-07-27 Thread Vikas Bhatia



Laszlo had a pretty nice debug window that you could embed in the client side swf. the debug window could provide complete introspection into the client side views. anything similar available for flex or is anything planned such as this?
On 7/27/06, Matt Chotin [EMAIL PROTECTED] wrote:













  













We've been thinking about trying to
expose a tool that would give you an accurate count of objects but it's
not something near-term. If the object is not on the display list (not in raw
children) but is still sticking around then you clearly have a reference to it
somewhere. Typically it would be an event listener that wasn't added
with a weak key or something that is referred to by another class that is on
the display list. Unfortunately I don't have a good technique for
finding those L












From:
[EMAIL PROTECTED]ups.com [mailto:
flexcoders@yahoogroups.com] On Behalf Of jeff tapper
Sent: Wednesday, July 26, 2006
12:47 PM
To: [EMAIL PROTECTED]ups.com
Subject: [flexcoders] Re: Tools
for listing objects











Darn, I've been able to prove to myself that the
object can still 
exist in memory but not be in the rawchildren. How can i get a 
handle on these orphans? Do I need to resort to creating a 
Dictionary Object with weak keys, and store an reference of every 
object created in there? Is there a more elegant solution?

--- In flexcoders@yahoogroups.com,
jeff tapper [EMAIL PROTECTED] wrote:

 Matt- 
 
 Your solutions didnt work for me, I suspect its because all the 
 children we create/destroy in this app are done via the popup 
 manager. Regardless how many children we created that way, I'm 
 always finding that:
 this.childDescriptors.toString();
 var o:Object = ObjectUtil.getClassInfo(Application.application);
 trace(ObjectUtil.toString(o));
 and Application.application.getChildren().toString()
return the 
same 
 things, whether there is 0 or 100 windows open. So far, the best 
 I've found for our needs is:
 
 var childList:IChildList = this.systemManager.rawChildren;
 for(var i:int=0;ichildList.numChildren;i++){
 trace(childList.getChildAt(i));
 }
 
 My fear is that there may be orphans, windows which have been 
 removed from the display list but which are still active in 
memory. 
 Any idea how to check on that?
 
 --- In flexcoders@yahoogroups.com,
Matt Horn mhorn@ wrote:
 
  I don't know about those tools you mention, but some ideas for 
 listing
  available objects:
  
  1) trace(this.childDescriptors.toString());
  
  2) var o:Object = ObjectUtil.getClassInfo
(Application.application);
  trace(ObjectUtil.toString(o));
  
  3) trace(Application.application.getChildren().toString());
  
  hth,
  
  matt horn
  flex docs 
  
   -Original Message-
   From: flexcoders@yahoogroups.com

   [mailto:flexcoders@yahoogroups.com]
On Behalf Of jeff tapper
   Sent: Wednesday, July 26, 2006 10:22 AM
   To: flexcoders@yahoogroups.com
   Subject: [flexcoders] Tools for listing objects
   
   Does any one know of a tool like OptimizeIt!
for java, or 
   like List Objects in Flash Studio for finding all
objects 
   currently in existance? We are looking to verify that we have 
   truely cleaned up objects no longer in use, and released them 
   to the GC, but without a tool like this, we cant tell what 
   exists and what doesnt. Does anyone have any tips?
   
   
   
   
  
 











  















__._,_.___





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com








   






  
  
SPONSORED LINKS
  
  
  

Web site design development
  
  
Computer software development
  
  
Software design and development
  
  


Macromedia flex
  
  
Software development best practice
  

   
  







  
  
  YAHOO! GROUPS LINKS



  Visit your group "flexcoders" on the web.
  To unsubscribe from this group, send an email to:[EMAIL PROTECTED]
  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  






__,_._,___



Re: [flexcoders] Re: Tools for listing objects

2006-07-27 Thread Tom Chiverton
On Thursday 27 July 2006 15:37, Vikas Bhatia wrote:
 Laszlo had a pretty nice debug window that you could embed in the  client
 side swf. the debug window could provide complete introspection into the
 client side views. anything similar available for flex or is anything
 planned such as this?

Guess what this does:
http://www.mikenimer.com/index.cfm/2006/7/5/FlexDebugPanel
:-)

-- 
Tom Chiverton



This email is sent for and on behalf of Halliwells LLP.

Halliwells LLP is a limited liability partnership registered in England and 
Wales under registered number OC307980 whose registered office address is at St 
James's Court Brown Street Manchester M2 2JF.  A list of members is available 
for inspection at the registered office. Any reference to a partner in relation 
to Halliwells LLP means a member of Halliwells LLP. Regulated by the Law 
Society.

CONFIDENTIALITY

This email is intended only for the use of the addressee named above and may be 
confidential or legally privileged.  If you are not the addressee you must not 
read it and must not use any information contained in nor copy it nor inform 
any person other than Halliwells LLP or the addressee of its existence or 
contents.  If you have received this email in error please delete it and notify 
Halliwells LLP IT Department on 0870 365 8008.

For more information about Halliwells LLP visit www.halliwells.com.



--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

* To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/

* To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

* Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
 





RE: [flexcoders] Re: Tools for listing objects

2006-07-27 Thread Matt Chotin












Theres no way to know if garbage
collection was forced. Create a method does does a for loop that creates
10,000 objects into mid-air.



For (var i:int=0; I  1; i++)

New Object();



That should trigger the garbage collector hopefully.











From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of jeff tapper
Sent: Thursday, July 27, 2006 5:56
AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: Tools
for listing objects











Well, that experiment failed as well. 14 hours later,
the same 
objects are still listed in the dictionary.
Wed Jul 26 17:07:23 GMT-0400 2006
Testing56:Testing56
Testing19:Testing19
Testing38:Testing38
Thu Jul 27 08:50:31 GMT-0400 2006
Testing56:Testing56
Testing19:Testing19
Testing38:Testing38

Am I misunderstanding the usage of Weak References in the 
Dictionary? Does anyone have any idea how this can be used to keep 
track of what objects exist and which dont?

--- In [EMAIL PROTECTED]ups.com,
jeff tapper [EMAIL PROTECTED] wrote:

 Ok, heres a sketch of what im trying now. 
 App.mxml
 
 ?xml version=1.0 encoding=utf-8?
 mx:Application xmlns:mx=http://www.adobe.com/2006/mxml

 layout=vertical creationComplete=initApp()
 mx:Script
 ![CDATA[
 import mx.managers.PopUpManager;
 import mx.managers.PopUpManagerChildList;
 import mx.core.IFlexDisplayObject;
 private var screenDict:Dictionary;
 private var scr1:IFlexDisplayObject;
 private function initApp():void{
 screenDict = new Dictionary(true);
 }
 public function createScreen
 (parent:DisplayObjectContainer, 
 screen:Class,modal:Boolean=false):IFlexDisplayObject{
 var s:IFlexDisplayObject = 
 PopUpManager.createPopUp(parent, screen, 
 modal,PopUpManagerChildList.APPLICATION);
 screenDict[s] = s.name
 return s;
 }
 public function showObjects():void{
 trace(new Date());
 for (var i:* in screenDict){
 trace(i+:+screenDict[i]);
 }
 }
 public function removeScreen
 (screen:IFlexDisplayObject):void{
 PopUpManager.removePopUp(screen);
 }
 private function makeScreen():void{
 if(scr1 == null){ 
 scr1 = createScreen
 (this,Testing,false);
 }
 }
 private function destroyScreen():void{
 removeScreen(scr1);
 scr1 = null;
 }
 
 ]]
 /mx:Script
 mx:Button click=makeScreen() label=make/
 mx:Button click=destroyScreen() label=kill/
 mx:Button click=showObjects() label=show/
 /mx:Application
 
 Testing.mxml
 =
 ?xml version=1.0 encoding=utf-8?
 mx:Panel xmlns:mx=http://www.adobe.com/2006/mxml
width=400 
 height=300
 mx:Button click=this.dispatchEvent(new Event('foo'))/
 /mx:Panel
 
 Now, as i run this, if i click make, kill, make, kill, show, The 
 trace shows:
 Wed Jul 26 17:07:14 GMT-0400 2006
 Testing58:Testing58
 Testing20:Testing20
 Testing39:Testing39
 
 Implying that the screens arent really being destroyed. Perhaps I 
 didnt wait long enough, so 5 minutes later, I tried the same 
thing, 
 with the same results. Maybe 5 minutes isnt long enough, so I'll 
 leave it running over night and try again in the morning. But, 
the 
 fundemental question is, have i done enough to remove the 
screens? 
 Should the garbage collector clean the unused ones up, or have i 
 somehow left a reference lingering?
 
 We have a very complex app, which I want to ensure we clean up all 
 unused objects, but im having trouble finding a way to verify they 
 are removed.







__._,_.___





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com








   






  
  
SPONSORED LINKS
  
  
  

Web site design development
  
  
Computer software development
  
  
Software design and development
  
  


Macromedia flex
  
  
Software development best practice
  

   
  







  
  
  YAHOO! GROUPS LINKS



  Visit your group "flexcoders" on the web.
  To unsubscribe from this group, send an email to:[EMAIL PROTECTED]
  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  






__,_._,___






[flexcoders] Re: Tools for listing objects

2006-07-27 Thread jeff tapper
Really, what im looking for, is some way to check if an object no 
longer exists.  I thought a weak reference in the dictionary might 
work for me, but after 14 hours of inactivity, those weak references 
are still there.  

Am i misunderstanding the nature of a weak reference?  Is there some 
other way that I can test to see if a given object still exists?

--- In flexcoders@yahoogroups.com, Matt Chotin [EMAIL PROTECTED] wrote:

 There's no way to know if garbage collection was forced.  Create a
 method does does a for loop that creates 10,000 objects into mid-
air.
 
  
 
 For (var i:int=0; I  1; i++)
 
 New Object();
 
  
 
 That should trigger the garbage collector hopefully.
 
  
 
 
 
 From: flexcoders@yahoogroups.com 
[mailto:[EMAIL PROTECTED] On
 Behalf Of jeff tapper
 Sent: Thursday, July 27, 2006 5:56 AM
 To: flexcoders@yahoogroups.com
 Subject: [flexcoders] Re: Tools for listing objects
 
  
 
 Well, that experiment failed as well. 14 hours later, the same 
 objects are still listed in the dictionary.
 Wed Jul 26 17:07:23 GMT-0400 2006
 Testing56:Testing56
 Testing19:Testing19
 Testing38:Testing38
 Thu Jul 27 08:50:31 GMT-0400 2006
 Testing56:Testing56
 Testing19:Testing19
 Testing38:Testing38
 
 Am I misunderstanding the usage of Weak References in the 
 Dictionary? Does anyone have any idea how this can be used to keep 
 track of what objects exist and which dont?
 
 --- In flexcoders@yahoogroups.com mailto:flexcoders%
40yahoogroups.com
 , jeff tapper jeff@ wrote:
 
  Ok, heres a sketch of what im trying now. 
  App.mxml
  
  ?xml version=1.0 encoding=utf-8?
  mx:Application xmlns:mx=http://www.adobe.com/2006/mxml
 http://www.adobe.com/2006/mxml  
  layout=vertical creationComplete=initApp()
  mx:Script
  ![CDATA[
  import mx.managers.PopUpManager;
  import mx.managers.PopUpManagerChildList;
  import mx.core.IFlexDisplayObject;
  private var screenDict:Dictionary;
  private var scr1:IFlexDisplayObject;
  private function initApp():void{
  screenDict = new Dictionary(true);
  }
  public function createScreen
  (parent:DisplayObjectContainer, 
  screen:Class,modal:Boolean=false):IFlexDisplayObject{
  var s:IFlexDisplayObject = 
  PopUpManager.createPopUp(parent, screen, 
  modal,PopUpManagerChildList.APPLICATION);
  screenDict[s] = s.name
  return s;
  }
  public function showObjects():void{
  trace(new Date());
  for (var i:* in screenDict){
  trace(i+:+screenDict[i]);
  }
  }
  public function removeScreen
  (screen:IFlexDisplayObject):void{
  PopUpManager.removePopUp(screen);
  }
  private function makeScreen():void{
  if(scr1 == null){ 
  scr1 = createScreen
  (this,Testing,false);
  }
  }
  private function destroyScreen():void{
  removeScreen(scr1);
  scr1 = null;
  }
  
  ]]
  /mx:Script
  mx:Button click=makeScreen() label=make/
  mx:Button click=destroyScreen() label=kill/
  mx:Button click=showObjects() label=show/
  /mx:Application
  
  Testing.mxml
  =
  ?xml version=1.0 encoding=utf-8?
  mx:Panel xmlns:mx=http://www.adobe.com/2006/mxml
 http://www.adobe.com/2006/mxml  width=400 
  height=300
  mx:Button click=this.dispatchEvent(new Event('foo'))/
  /mx:Panel
  
  Now, as i run this, if i click make, kill, make, kill, show, The 
  trace shows:
  Wed Jul 26 17:07:14 GMT-0400 2006
  Testing58:Testing58
  Testing20:Testing20
  Testing39:Testing39
  
  Implying that the screens arent really being destroyed. Perhaps 
I 
  didnt wait long enough, so 5 minutes later, I tried the same 
 thing, 
  with the same results. Maybe 5 minutes isnt long enough, so I'll 
  leave it running over night and try again in the morning. But, 
 the 
  fundemental question is, have i done enough to remove the 
 screens? 
  Should the garbage collector clean the unused ones up, or have i 
  somehow left a reference lingering?
  
  We have a very complex app, which I want to ensure we clean up 
all 
  unused objects, but im having trouble finding a way to verify 
they 
  are removed.
 







--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

* To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/

* To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

* Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
 





[flexcoders] Re: Tools for listing objects

2006-07-26 Thread ben.clinkinbeard
Couldn't you just set a breakpoint and use the debugger in FB?

Ben
http://www.returnundefined.com/

--- In flexcoders@yahoogroups.com, jeff tapper [EMAIL PROTECTED] wrote:

 Does any one know of a tool like OptimizeIt! for java, or like List 
 Objects in Flash Studio for finding all objects currently in 
 existance?  We are looking to verify that we have truely cleaned up 
 objects no longer in use, and released them to the GC, but without a 
 tool like this, we cant tell what exists and what doesnt.  Does anyone 
 have any tips?








 Yahoo! Groups Sponsor ~-- 
Check out the new improvements in Yahoo! Groups email.
http://us.click.yahoo.com/7EuRwD/fOaOAA/yQLSAA/nhFolB/TM
~- 

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

* To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/

* To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

* Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
 




[flexcoders] Re: Tools for listing objects

2006-07-26 Thread jeff tapper
Matt- 

Your solutions didnt work for me, I suspect its because all the 
children we create/destroy in this app are done via the popup 
manager.  Regardless how many children we created that way, I'm 
always finding that:
this.childDescriptors.toString();
var o:Object = ObjectUtil.getClassInfo(Application.application);
trace(ObjectUtil.toString(o));
and Application.application.getChildren().toString() return the same 
things, whether there is 0 or 100 windows open.  So far, the best 
I've found for our needs is:

var childList:IChildList = this.systemManager.rawChildren;
for(var i:int=0;ichildList.numChildren;i++){
  trace(childList.getChildAt(i));
}

My fear is that there may be orphans, windows which have been 
removed from the display list but which are still active in memory.  
Any idea how to check on that?

--- In flexcoders@yahoogroups.com, Matt Horn [EMAIL PROTECTED] wrote:

 I don't know about those tools you mention, but some ideas for 
listing
 available objects:
 
 1) trace(this.childDescriptors.toString());
   
 2) var o:Object = ObjectUtil.getClassInfo(Application.application);
 trace(ObjectUtil.toString(o));
   
 3) trace(Application.application.getChildren().toString());
 
 hth,
 
 matt horn
 flex docs  
 
  -Original Message-
  From: flexcoders@yahoogroups.com 
  [mailto:[EMAIL PROTECTED] On Behalf Of jeff tapper
  Sent: Wednesday, July 26, 2006 10:22 AM
  To: flexcoders@yahoogroups.com
  Subject: [flexcoders] Tools for listing objects
  
  Does any one know of a tool like OptimizeIt! for java, or 
  like List Objects in Flash Studio for finding all objects 
  currently in existance? We are looking to verify that we have 
  truely cleaned up objects no longer in use, and released them 
  to the GC, but without a tool like this, we cant tell what 
  exists and what doesnt. Does anyone have any tips?
  
  
  
   
 








--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

* To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/

* To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

* Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
 





[flexcoders] Re: Tools for listing objects

2006-07-26 Thread jeff tapper
Darn, I've been able to prove to myself that the object can still 
exist in memory but not be in the rawchildren.  How can i get a 
handle on these orphans?  Do I need to resort to creating a 
Dictionary Object with weak keys, and store an reference of every 
object created in there? Is there a more elegant solution?

--- In flexcoders@yahoogroups.com, jeff tapper [EMAIL PROTECTED] wrote:

 Matt- 
 
 Your solutions didnt work for me, I suspect its because all the 
 children we create/destroy in this app are done via the popup 
 manager.  Regardless how many children we created that way, I'm 
 always finding that:
 this.childDescriptors.toString();
 var o:Object = ObjectUtil.getClassInfo(Application.application);
   trace(ObjectUtil.toString(o));
 and Application.application.getChildren().toString() return the 
same 
 things, whether there is 0 or 100 windows open.  So far, the best 
 I've found for our needs is:
 
 var childList:IChildList = this.systemManager.rawChildren;
 for(var i:int=0;ichildList.numChildren;i++){
   trace(childList.getChildAt(i));
 }
 
 My fear is that there may be orphans, windows which have been 
 removed from the display list but which are still active in 
memory.  
 Any idea how to check on that?
 
 --- In flexcoders@yahoogroups.com, Matt Horn mhorn@ wrote:
 
  I don't know about those tools you mention, but some ideas for 
 listing
  available objects:
  
  1) trace(this.childDescriptors.toString());
  
  2) var o:Object = ObjectUtil.getClassInfo
(Application.application);
  trace(ObjectUtil.toString(o));
  
  3) trace(Application.application.getChildren().toString());
  
  hth,
  
  matt horn
  flex docs
  
   -Original Message-
   From: flexcoders@yahoogroups.com 
   [mailto:[EMAIL PROTECTED] On Behalf Of jeff tapper
   Sent: Wednesday, July 26, 2006 10:22 AM
   To: flexcoders@yahoogroups.com
   Subject: [flexcoders] Tools for listing objects
   
   Does any one know of a tool like OptimizeIt! for java, or 
   like List Objects in Flash Studio for finding all objects 
   currently in existance? We are looking to verify that we have 
   truely cleaned up objects no longer in use, and released them 
   to the GC, but without a tool like this, we cant tell what 
   exists and what doesnt. Does anyone have any tips?
   
   
   

  
 







 Yahoo! Groups Sponsor ~-- 
Yahoo! Groups gets a make over. See the new email design.
http://us.click.yahoo.com/WktRrD/lOaOAA/yQLSAA/nhFolB/TM
~- 

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

* To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/

* To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

* Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
 




[flexcoders] Re: Tools for listing objects

2006-07-26 Thread jeff tapper
Ok, heres a sketch of what im trying now. 
App.mxml

?xml version=1.0 encoding=utf-8?
mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; 
layout=vertical creationComplete=initApp()
mx:Script
![CDATA[
import mx.managers.PopUpManager;
import mx.managers.PopUpManagerChildList;
import mx.core.IFlexDisplayObject;
private var screenDict:Dictionary;
private var scr1:IFlexDisplayObject;
private function initApp():void{
screenDict = new Dictionary(true);
}
public function createScreen
(parent:DisplayObjectContainer, 
screen:Class,modal:Boolean=false):IFlexDisplayObject{
var s:IFlexDisplayObject = 
PopUpManager.createPopUp(parent, screen, 
modal,PopUpManagerChildList.APPLICATION);
screenDict[s] = s.name
return s;
}
public function showObjects():void{
trace(new Date());
for (var i:* in screenDict){
trace(i+:+screenDict[i]);
}
}
public function removeScreen
(screen:IFlexDisplayObject):void{
PopUpManager.removePopUp(screen);
}
private function makeScreen():void{
if(scr1 == null){   
scr1 = createScreen
(this,Testing,false);
}
}
private function destroyScreen():void{
removeScreen(scr1);
scr1 = null;
}

]]
/mx:Script
mx:Button click=makeScreen() label=make/
mx:Button click=destroyScreen() label=kill/
mx:Button click=showObjects() label=show/
/mx:Application

Testing.mxml
=
?xml version=1.0 encoding=utf-8?
mx:Panel xmlns:mx=http://www.adobe.com/2006/mxml; width=400 
height=300
mx:Button click=this.dispatchEvent(new Event('foo'))/
/mx:Panel

Now, as i run this, if i click make, kill, make, kill, show, The 
trace shows:
Wed Jul 26 17:07:14 GMT-0400 2006
Testing58:Testing58
Testing20:Testing20
Testing39:Testing39

Implying that the screens arent really being destroyed.  Perhaps I 
didnt wait long enough, so 5 minutes later, I tried the same thing, 
with the same results.  Maybe 5 minutes isnt long enough, so I'll 
leave it running over night and try again in the morning.  But, the 
fundemental question is, have i done enough to remove the screens?  
Should the garbage collector clean the unused ones up, or have i 
somehow left a reference lingering?

We have a very complex app, which I want to ensure we clean up all 
unused objects, but im having trouble finding a way to verify they 
are removed.










--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

* To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/

* To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

* Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
 





RE: [flexcoders] Re: Tools for listing objects

2006-07-26 Thread Matt Chotin












Weve been thinking about trying to
expose a tool that would give you an accurate count of objects but its
not something near-term. If the object is not on the display list (not in raw
children) but is still sticking around then you clearly have a reference to it
somewhere. Typically it would be an event listener that wasnt added
with a weak key or something that is referred to by another class that is on
the display list. Unfortunately I dont have a good technique for
finding those L











From:
flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of jeff tapper
Sent: Wednesday, July 26, 2006
12:47 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: Tools
for listing objects











Darn, I've been able to prove to myself that the
object can still 
exist in memory but not be in the rawchildren. How can i get a 
handle on these orphans? Do I need to resort to creating a 
Dictionary Object with weak keys, and store an reference of every 
object created in there? Is there a more elegant solution?

--- In [EMAIL PROTECTED]ups.com,
jeff tapper [EMAIL PROTECTED] wrote:

 Matt- 
 
 Your solutions didnt work for me, I suspect its because all the 
 children we create/destroy in this app are done via the popup 
 manager. Regardless how many children we created that way, I'm 
 always finding that:
 this.childDescriptors.toString();
 var o:Object = ObjectUtil.getClassInfo(Application.application);
 trace(ObjectUtil.toString(o));
 and Application.application.getChildren().toString()
return the 
same 
 things, whether there is 0 or 100 windows open. So far, the best 
 I've found for our needs is:
 
 var childList:IChildList = this.systemManager.rawChildren;
 for(var i:int=0;ichildList.numChildren;i++){
 trace(childList.getChildAt(i));
 }
 
 My fear is that there may be orphans, windows which have been 
 removed from the display list but which are still active in 
memory. 
 Any idea how to check on that?
 
 --- In [EMAIL PROTECTED]ups.com,
Matt Horn mhorn@ wrote:
 
  I don't know about those tools you mention, but some ideas for 
 listing
  available objects:
  
  1) trace(this.childDescriptors.toString());
  
  2) var o:Object = ObjectUtil.getClassInfo
(Application.application);
  trace(ObjectUtil.toString(o));
  
  3) trace(Application.application.getChildren().toString());
  
  hth,
  
  matt horn
  flex docs 
  
   -Original Message-
   From: [EMAIL PROTECTED]ups.com

   [mailto:[EMAIL PROTECTED]ups.com]
On Behalf Of jeff tapper
   Sent: Wednesday, July 26, 2006 10:22 AM
   To: [EMAIL PROTECTED]ups.com
   Subject: [flexcoders] Tools for listing objects
   
   Does any one know of a tool like OptimizeIt!
for java, or 
   like List Objects in Flash Studio for finding all
objects 
   currently in existance? We are looking to verify that we have 
   truely cleaned up objects no longer in use, and released them 
   to the GC, but without a tool like this, we cant tell what 
   exists and what doesnt. Does anyone have any tips?
   
   
   
   
  
 







__._,_.___





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com








   






  
  
SPONSORED LINKS
  
  
  

Web site design development
  
  
Computer software development
  
  
Software design and development
  
  


Macromedia flex
  
  
Software development best practice
  

   
  







  
  
  YAHOO! GROUPS LINKS



  Visit your group "flexcoders" on the web.
  To unsubscribe from this group, send an email to:[EMAIL PROTECTED]
  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  






__,_._,___