Thanks for the tips. I a couple questions about your comments.

- question regarding number 3,5... is there a deconstructor in
ActionScript that I can place cleanup code? 

- number 6 what do you mean by activation object? Do you mean
RemoteObject? if so, could you please explain how to clean it up
properly, as I need to use it, and there was no documentation on how
to clean it up.

Thanks!

--- In [email protected], "JesterXL" <[EMAIL PROTECTED]> wrote:
>
> 6 rules of thumb:
> 
> 1. never trust an alpha for benchmarking
> 
> 2. never trust a beta for benchmarking
> 
> 3. if it's a member variable, delete it:
> 
> delete myVar;
> 
> 4. if it's a local variable, null it at the end of the function:
> 
> function cow()
> {
>     var a:String = "";
>     a += "one";
>     a += "two";
>     a = null;
> }
> 
> 5. remove your event listeners before destroying the objects you
registered 
> with
> 
> 6. do not use the activation object unless you know how to clear it
later 
> (most people I've seen in AS2 never do, so try not to use it period). 
> Example is xml.onLoad where the xml is created as a local variable in a 
> function.  It'll live on even though it's a local variable.
> 
> ----- Original Message ----- 
> From: "thunderstumpgesatwork" <[EMAIL PROTECTED]>
> To: <[email protected]>
> Sent: Saturday, February 18, 2006 7:02 PM
> Subject: [flexcoders] Object cleanup and memory usage "Best Practices" 
> (2.0b1)
> 
> 
> Hi all,
> 
> I've been coding in Flex now for a few months (basically since the 2.0
> Alpha came out) and I've been having a heck of a problem with memory
> leaks.
> 
> I was curious if there's any kind of rules or best practices to use
> for cleaning up AS objects (destructors? finalize()? or other?) This
> is especially pertinent because I am using lists/hash's, charts, and
> RPC Services.
> 
> I couldn't really find any documentation regarding clean-up and memory
> leaks. Does anyone out there have any experiences/knowledge to share?
> 
> Below, I'll outline my architecture, and note that I have no
> cleanup/de-construction code right now at all, other than setting
> variable references to new objects or null. Sorry it's pretty long, so
> if you want to stop reading here and provide any ideas you have, feel
> free =)
> 
> thanks,
> Thunder
> _____________
> 
> 
> Basically I am running dynamic DB queries through a singleton
> RemoteObject called by a "ChartResults" class that holds the results
> (e4x XML) of the query and metadata info related to it. I have
> employed the "Asynchronous Completion Token" documented approach to
> allow the ChartResults classes to pick out only their calls from the
> singleton R.O.
> Is this detrimental to performance if there are anywhere from 4-10 SQL
> calls possibly going through the one RemoteObject? (note - that's an
> upper limit during initial startup only)
> 
> The ChartResults class caches information as it is retrieved from the
> results (often after performing filtering/sorting, etc).
> 
> When a new query result comes in, the I clear all the cache
> items by setting the hash objects or Array to null or new Object/Array
> respectively.
> 
> 1 - Does setting a property referencing a Collection to null also
> release the source Array held in it?
> 
> 2 - Do I also need to set each item in the Array to null?
> 
> 3 - If a hash Object had many different XMLList properties cached,
> do I need to iterate and null all these properties using introspection?
> 
> Also, on the Chart side, I have been deleting the series array and
> creating a new one when re-populating the chart (if it is showing
> entirely new/different data).
> 
> 4 - Do I need to do any cleanup of the series items maybe?
> 
> 5 - Are the Series getting cleaned up and releasing their dataProvider
> objects?
> 
> Somewhere I am leaking memory badly as the number of chart queries
> goes up and up...
> 
> Thanks again!
> Thunder
> 
> 
> 
> 
> 
> 
> --
> 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
>






--
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/
 



Reply via email to