0 Replies Latest reply on Feb 1, 2007 10:43 AM by Adrian Brock

    Experimental notion of attachments for types

    Adrian Brock Master

      I've introduced an experimental notion of attachments for types in the TypeInfo api.

      This allows for easier caching of information related to a type.

      It also means that when we introduce a better caching mechanism than the
      WeakTypeCache we can control better what gets flushed from memory because
      it is not being used.

      My one concern is that this information is public so it would probably need
      a security permission to allow modifcation.

      Given that concern, it might be better to just use a more normal

      WeakHashMap<TypeInfo, WeakReference<ObjectCached>>

      where you want to do caching instead?

      But the internal weak hashmap doesn't allow the information to be shared as easily
      and it means ugly handling of the WeakReferences.

      Also multiple WeakReferences for each cached object is something that
      really stresses the GC.