This line is the issue. You’re setting the MAX_SIZE
of each entry in your map to u32::MAX
. Internally, the map allocates the MAX_SIZE
memory for each entry. You’ve configured it to allocate 4GiB of memory for every single entry in your map, and that’s why it fails.
I recommend you set the MAX_SIZE
to be as tight as possible. We’re also working on removing the MAX_SIZE
requirement from BTreeMaps, and we should have a beta release of it this month. See this discussion.