A weak reference is a reference that does not protect the referenced object from deallocation

learn more… | top users | synonyms

1
vote
1answer
50 views

Minimal Map implementation with weak values

What follows is an implementation of the java.util.Map interface with weak values. This means that entries should be removed from the map when their values become ...
6
votes
1answer
118 views

Image cache for lots of images 2.0

Following from this question I created a Image cache of sorts (let's call it version 1.0) that used WeakReference as "cache" items. And this comes from the ...
1
vote
1answer
382 views

Image cache for lots of images using WeakReference on C#

I'm developing an application to manage a player card-library from an online game. Each card has an image that is stored on disk with a numeric code, for example, the card with ID=1234 has his image ...
0
votes
1answer
122 views

A double mapped cache with WeakReferences for second key type

I needed a way to cache a large number of objects with two different types of keys. In my case: A String key represents my object in a serialized form. This way ...
4
votes
1answer
463 views

Wrapping bound methods

I've written this small class in Python that wraps bound methods but does not prevent the deletion of self. Do you have any thoughts on my code? Do you think I handle errors appropriately? Is it ...
4
votes
1answer
246 views

Generic 'temporary instance' class

I've been reading about WeakPointer and WeakPointer<T> today, and it looks very useful. Rather than just using it as-is ...
3
votes
1answer
358 views

What is the right way to “remove” Reference from it's ReferenceQueue?

Sometimes I need to ensure that some references won't be processed while examination from the associated ReferenceQueue. Generally at those moments I don't know reachability status of the referent. ...
2
votes
1answer
2k views

Observer pattern in Java

I'm going to have a lot of integer values, and at any value change I might need to update any number of UI elements, other values which are computed from the first ones, etc. Sounds like time for the ...