[flexcoders] How to instantiate a weak reference

2009-02-03 Thread Greg Hess
Hi All, I am implementing a cache for my application and I would like to allow my cache to manage memory consumption(limit number of items stored). I have done this in the past in Java by having my cache hold the only hard references to the objects, returning weak references to the application.

Re: [flexcoders] How to instantiate a weak reference

2009-02-03 Thread Alan K
I don't understand. Event pointers can be instanciated as weak. Do you mean an object with a weak reference to another? e.g var foo:Object = 'First'; var bar:Object = foo; // destroy object foo // foo still exists because of object bar Alan However, I cant seem to find any way to

Re: [flexcoders] How to instantiate a weak reference

2009-02-03 Thread Greg Hess
Objects are all passed by reference, I want to pass a weak reference back to callers who request items from the cache, much like the internal implementation must do in some way when addEventListener(...true) as a weak reference. For example: public function getItem( id:String ):Item { var

Re: [flexcoders] How to instantiate a weak reference

2009-02-03 Thread Greg Hess
Very interesting. Not exactly what I wanted but I guess that's what I will have to work with in AS. I was hoping I could just return WeakReferences that would resolve to the type it is referencing, but for that I guess we need support from the VM. So seamless in Java. So for me to implement a

Re: [flexcoders] How to instantiate a weak reference

2009-02-03 Thread Manish Jethani
On Tue, Feb 3, 2009 at 11:11 PM, Greg Hess flexeff...@gmail.com wrote: Objects are all passed by reference, I want to pass a weak reference back to callers who request items from the cache, much like the internal implementation must do in some way when addEventListener(...true) as a weak