I'm making a game using membrane, and every frame I am creating new elements. I noticed I had a memory leak, and I tracked it down to the memoize in membrane.ui/bounds. Is it really a good idea to memoize there?
Oh, weakhashmap sounds like a good idea. I will try it.
caching membrane.ui/bounds is very important for performance for typical UIs. I've cleaned up some memory leaks on master. bounds now uses a threadlocal weakhashmap, https://github.com/phronmophobic/membrane/blob/93835080c35b86409e6a9ef416ef0e3eae353ac6/src/membrane/ui.cljc#L17.
I've been running this version locally for a few months and it seems to be working well.
There's a bunch of different caches. There are also lots of different caching strategies with various tradeoffs. Eventually, I'd like to have some way to simplify the caching so different use cases can make different decisions.