I am looking over the WeakCache class and I am wondering if the following scenario is possible: The WeakCache has a large number of entries, greater than the size of the internal MRU cache when the transaction commits. This could happen if the application was maintaining its own hard references to those runtime objects, e.g., in some caches or temporary data structures. During the commit the CacheRecordManager will ask for an enumeration of the objects in the cache. The enumeration provided will visit the members of the internal MRU, not those in the weak value cache. Since the weak cache has more objects that can fit on the internal MRU cache, some dirty objects will not be reported to the cache record manager and the transaction will not commit all changes.
I think that what we need to do is place the dirty objects onto a linked list whose elements are indexed by a hash table (much like the MRU entries, but without a reordering or eviction policy) and then scan just the list of dirty objects during the commit. Objects evicted from the MRU would be removed from the dirty list as they are laid down onto page images. (Per the semantics of the dirty list, an object whose state is current on the page image does not belong on the dirty list).