In your doSomething() static function, 'arr' is a local variable and therefore 
ceases to exist when doSomething() returns. Therefore the Array object that it 
points to becomes eligible for garbage collection.

If 'arr' were a static var, doSomething() should set it to null before 
returning if you want to make the Array object eligible for garbage collection. 
Otherwise the static var, which always exists, would continue to point to it 
and prevent the Array object from being GCd.

Gordon Smith
Adobe Flex SDK Team

From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Paul 
Andrews
Sent: Wednesday, December 03, 2008 5:46 PM
To: [email protected]
Subject: Re: [flexcoders] Error 1189: Attempt to delete the fixed property.


----- Original Message -----
From: "devenhariyani" <[EMAIL PROTECTED]<mailto:devenhariyani%40yahoo.com>>
To: <[email protected]<mailto:flexcoders%40yahoogroups.com>>
Sent: Thursday, December 04, 2008 1:21 AM
Subject: [flexcoders] Error 1189: Attempt to delete the fixed property.

> hello,
>
> I'm having some very confusing problems with memory leaks. in one
> particular function, I dynamically create a new Array(), and when i
> try to delete it I get a compile time error. a simplified version of
> the function looks like:
>
> public static function doSomething():void {
> var arr:Array = new Array();
>
> //do somestuff with the array
>
> delete(arr);
> }
>
> When compiling I get the error:
>
> Error 1189: Attempt to delete the fixed property arr. Only
> dynamically defined properties can be deleted.

The array isn't added dynamically - it's declared so you may not delete it.

The storage allocated for the array will be eligible for garbage collection
(provided nothing else is referencing the array) when you leave the
function - it's no longer in scope.

In other circumatsnces, you can make the array eligible for garbage
collection by setting arr to null (provided nothing else is referencing the
array).

Paul

>
> In a different situation, I also get similar problems. For example,
> when I have a private property that is part of my Application class i
> assign dynamic data to it during the life of the app, but i cannot
> delete it.
>
> --Deven

Reply via email to