Hm, I'm a bit hazy on the details, but I thought we've managed to avoid allocation on C-heap so far. Couldn't we manage the min/max key the same way and avoid the mallocs and frees in various places?