[flexcoders] garbage collection question

2010-07-29 Thread djbrown_rotonews
I'm trying to track down a memory leak in one of my applications, having 
already employed the use weak reference in dictionaries and eventListeners 
guideline.

I have an wrapper object, that has (among other properties) a reference to 
another object, which contains an array of a third object.

Does simply nulling the parent effectively mark the embedded object(s) for GC, 
or do I need to iterate over the internal object array and null them out 
individually?



Re: [flexcoders] garbage collection question

2010-07-29 Thread Oleg Sivokon
1. Using weak references is the last thing you should do, whenever possible
you should avoid it. By doing so you leave all means of control of the
object, and if the object has some kind of behavior that will keep it
alive, you won't be able to delete it ever (example, the *deleted* object
did not close LocalConnection).
It is not possible to conclude from what you describe whether objects will
be removed or not. The objects will be removed when there will be no
reference to the roots. Roots are local variables, or field
initializers. These are either persistent or temporary, local variables
would be an example of temporary roots.
Imagine this life span of an object:

public var persistent:Object;
public var anotherProperty:Object;
public var revealPresense:Dictionary = new Dictionary(true);

public function DocumentClass()
{
super();
var temporary:Object = new Object(); // the object created, put into the
heap, bound to the temporary toot
persistent = temporary; // the object is in heap, now referenced by two
variables.
} // temporary variable is destroyed, now the object is only referenced by
persistent root.

public function anotherMethod():void
{
anotherProperty = persistent; // the object is still in heap, but now
has two persistent roots.
persistent = null; // the object is still not eligible for GC, it is
referenced by persistent root.
revealPresense[anotherProperty] = true; // let's store a weak reference
and observe the object deletion.
anotherProperty = null; // the object is no longer referenced, but may
exist for some time.
for (var obj:Object in revealPresense) trace( obj ); // it may be still
here...
setInterval(checkPresense, 1);
}

public function checkPresense():void
{
for (var obj:Object in revealPresense) trace( obj ); // it may be still
here...
}


Re: [flexcoders] garbage collection question

2010-07-29 Thread Alex Harui
The profiler will show you who is still referencing the object.


On 7/29/10 1:01 PM, djbrown_rotonews djbrown_roton...@yahoo.com wrote:






I'm trying to track down a memory leak in one of my applications, having 
already employed the use weak reference in dictionaries and eventListeners 
guideline.

I have an wrapper object, that has (among other properties) a reference to 
another object, which contains an array of a third object.

Does simply nulling the parent effectively mark the embedded object(s) for GC, 
or do I need to iterate over the internal object array and null them out 
individually?






--
Alex Harui
Flex SDK Team
Adobe System, Inc.
http://blogs.adobe.com/aharui


[flexcoders] Garbage Collection question

2008-09-10 Thread Josh McDonald
Guys, just a quick question for anybody skilled up on the voodoo - I'm not
100% sure of a way to test this yet so I thought I'd ask: I assume the
Garabage Collector is a background thread so far as mark-and-sweep etc, but
does it do actual collecting while AVM2 is processing bytecode? I'm just
worried about bugs creeping into some funky-stuff I'm doing using the
Dictionary class :)

-Josh

-- 
Therefore, send not to know For whom the bell tolls. It tolls for thee.

http://flex.joshmcdonald.info/

:: Josh 'G-Funk' McDonald
:: 0437 221 380 :: [EMAIL PROTECTED]


RE: [flexcoders] Garbage Collection question

2008-09-10 Thread Alex Harui
Dude, read my blog :)

There is no background/threading in the player per-se.  GC is kicked off when 
try to allocate memory from the player's heap and the player is trying to avoid 
asking the OS for more memory.  Totally synchronous, happens during the new, 
and can delay the time until the next render.

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Josh 
McDonald
Sent: Wednesday, September 10, 2008 8:24 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Garbage Collection question

Guys, just a quick question for anybody skilled up on the voodoo - I'm not 100% 
sure of a way to test this yet so I thought I'd ask: I assume the Garabage 
Collector is a background thread so far as mark-and-sweep etc, but does it do 
actual collecting while AVM2 is processing bytecode? I'm just worried about 
bugs creeping into some funky-stuff I'm doing using the Dictionary class :)

-Josh

--
Therefore, send not to know For whom the bell tolls. It tolls for thee.

http://flex.joshmcdonald.info/

:: Josh 'G-Funk' McDonald
:: 0437 221 380 :: [EMAIL PROTECTED]mailto:[EMAIL PROTECTED]



Re: [flexcoders] Garbage Collection question

2008-09-10 Thread Josh McDonald
Hey I read it, it didn't answer *this* question :) I know it's started when
you allocated something, I just didn't know whether the actual collection
would pause the vm or if it simply went and cleaned up on another thread. I
know the VM's single threaded, I just figured the player would have all sort
of threads for useful stuff like rendering, watching keyboard / mouse,
mark-and-sweep for the GC, etc.

But it looks like I needn't be worried, which is good news to me :)

Cheers,
-Josh

On Thu, Sep 11, 2008 at 2:30 PM, Alex Harui [EMAIL PROTECTED] wrote:

  Dude, read my blog J



 There is no background/threading in the player per-se.  GC is kicked off
 when try to allocate memory from the player's heap and the player is trying
 to avoid asking the OS for more memory.  Totally synchronous, happens during
 the new, and can delay the time until the next render.



 *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On
 Behalf Of *Josh McDonald
 *Sent:* Wednesday, September 10, 2008 8:24 PM
 *To:* flexcoders@yahoogroups.com
 *Subject:* [flexcoders] Garbage Collection question



 Guys, just a quick question for anybody skilled up on the voodoo - I'm not
 100% sure of a way to test this yet so I thought I'd ask: I assume the
 Garabage Collector is a background thread so far as mark-and-sweep etc, but
 does it do actual collecting while AVM2 is processing bytecode? I'm just
 worried about bugs creeping into some funky-stuff I'm doing using the
 Dictionary class :)

 -Josh

 --
 Therefore, send not to know For whom the bell tolls. It tolls for thee.

 http://flex.joshmcdonald.info/

 :: Josh 'G-Funk' McDonald
 :: 0437 221 380 :: [EMAIL PROTECTED]

  




-- 
Therefore, send not to know For whom the bell tolls. It tolls for thee.

http://flex.joshmcdonald.info/

:: Josh 'G-Funk' McDonald
:: 0437 221 380 :: [EMAIL PROTECTED]


RE: [flexcoders] Garbage Collection question

2008-09-10 Thread Alex Harui
Player is pretty simple, at least in Windows.  I haven't seen many threads if 
any.  Input is based on Windows messages, I/O uses non-blocking, etc.

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Josh 
McDonald
Sent: Wednesday, September 10, 2008 9:57 PM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] Garbage Collection question

Hey I read it, it didn't answer *this* question :) I know it's started when you 
allocated something, I just didn't know whether the actual collection would 
pause the vm or if it simply went and cleaned up on another thread. I know the 
VM's single threaded, I just figured the player would have all sort of threads 
for useful stuff like rendering, watching keyboard / mouse, mark-and-sweep for 
the GC, etc.

But it looks like I needn't be worried, which is good news to me :)

Cheers,
-Josh
On Thu, Sep 11, 2008 at 2:30 PM, Alex Harui [EMAIL PROTECTED]mailto:[EMAIL 
PROTECTED] wrote:

Dude, read my blog :)



There is no background/threading in the player per-se.  GC is kicked off when 
try to allocate memory from the player's heap and the player is trying to avoid 
asking the OS for more memory.  Totally synchronous, happens during the new, 
and can delay the time until the next render.



From: flexcoders@yahoogroups.commailto:flexcoders@yahoogroups.com 
[mailto:flexcoders@yahoogroups.commailto:flexcoders@yahoogroups.com] On 
Behalf Of Josh McDonald
Sent: Wednesday, September 10, 2008 8:24 PM
To: flexcoders@yahoogroups.commailto:flexcoders@yahoogroups.com
Subject: [flexcoders] Garbage Collection question



Guys, just a quick question for anybody skilled up on the voodoo - I'm not 100% 
sure of a way to test this yet so I thought I'd ask: I assume the Garabage 
Collector is a background thread so far as mark-and-sweep etc, but does it do 
actual collecting while AVM2 is processing bytecode? I'm just worried about 
bugs creeping into some funky-stuff I'm doing using the Dictionary class :)

-Josh

--
Therefore, send not to know For whom the bell tolls. It tolls for thee.

http://flex.joshmcdonald.info/

:: Josh 'G-Funk' McDonald
:: 0437 221 380 :: [EMAIL PROTECTED]mailto:[EMAIL PROTECTED]



--
Therefore, send not to know For whom the bell tolls. It tolls for thee.

http://flex.joshmcdonald.info/

:: Josh 'G-Funk' McDonald
:: 0437 221 380 :: [EMAIL PROTECTED]mailto:[EMAIL PROTECTED]



[flexcoders] Garbage Collection question

2007-11-17 Thread Mike Krotscheck
I've been digging into memory management techniques recently, and have a
question regarding the timing of the two methods. The articles on
Adobe.com suggest that both methods (Ref Count and Mark  Sweep) run at
some arbitrary point in the future defined by current memory usage. I
found a discussion about the Virtual Machine though that indicated
garbage collection happens on a 30ms interval.

 

These two suggest that the two methods run on different intervals, and
given that Mark and Sweep is more processor intensive I assume that it
is the one whose timing is triggered by memory usage, while Reference
counting operates on the mentioned 30ms. Is that correct?

 

Links:

http://www.adobe.com/devnet/flashplayer/articles/garbage_collection.html

(some point in the future)

http://techpolesen.blogspot.com/2007/11/avm2-vs-jvm-and-actionscript3.ht
ml

(30ms time slice)

 

Michael Krotscheck

Senior Developer

 
RESOURCE INTERACTIVE

http://www.resource.com/ www.resource.com http://www.resource.com 

[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] 

 



This email and any of its attachments may contain Resource Interactive
proprietary information, which is privileged, confidential and may be
subject to copyright or other intellectual property rights belonging to
Resource Interactive. This email is intended solely for the use of the
individual or entity to which it is addressed. If you are not the
intended recipient of this email, you are hereby notified that any
dissemination, distribution, copying or action taken in relation to the
contents of and attachments to this email is strictly prohibited and may
be unlawful. If you have received this email in error, please notify the
sender immediately and permanently delete the original and any copy of
this email and any printout.




RE: [flexcoders] Garbage Collection question

2007-11-17 Thread Alex Harui
I can pretty much guarantee that mark and sweep does not run via timer,
and only on allocation.  I don't think there's a timer for DRC, but I
could be wrong about that.

 



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Mike Krotscheck
Sent: Saturday, November 17, 2007 7:02 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Garbage Collection question

 

I've been digging into memory management techniques recently, and have a
question regarding the timing of the two methods. The articles on
Adobe.com suggest that both methods (Ref Count and Mark  Sweep) run at
some arbitrary point in the future defined by current memory usage. I
found a discussion about the Virtual Machine though that indicated
garbage collection happens on a 30ms interval.

 

These two suggest that the two methods run on different intervals, and
given that Mark and Sweep is more processor intensive I assume that it
is the one whose timing is triggered by memory usage, while Reference
counting operates on the mentioned 30ms. Is that correct?

 

Links:

http://www.adobe.com/devnet/flashplayer/articles/garbage_collection.html
http://www.adobe.com/devnet/flashplayer/articles/garbage_collection.htm
l 

(some point in the future)

http://techpolesen.blogspot.com/2007/11/avm2-vs-jvm-and-actionscript3.ht
ml
http://techpolesen.blogspot.com/2007/11/avm2-vs-jvm-and-actionscript3.h
tml 

(30ms time slice)

 

Michael Krotscheck

Senior Developer

 


RESOURCE INTERACTIVE

http://www.resource.com/ www.resource.com http://www.resource.com 

[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] 

 



This email and any of its attachments may contain Resource Interactive
proprietary information, which is privileged, confidential and may be
subject to copyright or other intellectual property rights belonging to
Resource Interactive. This email is intended solely for the use of the
individual or entity to which it is addressed. If you are not the
intended recipient of this email, you are hereby notified that any
dissemination, distribution, copying or action taken in relation to the
contents of and attachments to this email is strictly prohibited and may
be unlawful. If you have received this email in error, please notify the
sender immediately and permanently delete the original and any copy of
this email and any printout.