Howdy,
The key is usually a lightweight value object and the JVM isn't
particularly a good fit for explicit memory management. I had
originally thought that wasn't a popular use-case, e.g. off-heap
ByteBuffers. At the time I was mostly concerned with collection
values, since I'd seen poor usages cause memory leaks. I was also
accustomed to using a 2nd level cache (memcached) for off-heap memory
management and used soft-ref as a failsafe if experiencing JVM memory
pressure. In retrospect, I should have included the key for more
flexibility. So far its not been an issue, at least in that you're the
first to bring it up.
We plan to add this feature to MapMaker and supply both the key and
value to that function. That's the long-term solution, but I'm not
sure when that enhancement will be started.
If you can demonstrate a clear need where this limitation is causing
problems, then I'd be open to resolving it. Otherwise I'd defer until
MapMaker has evolved to be a satisfactory upgrade path.
Cheers,
Ben