Repository navigation
HashSet and HashMap use MR::Allocator - #7245
Merged
Merged
Conversation
MRMeshFwd.h includes MRAllocator.h, which now needs only config.h, so the hash container aliases can name MR::Allocator. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The C bindings are generated once in the Emscripten image, where the alias was std::allocator, so their phmap::flat_hash_map<K, V> did not match MR::HashMap on native platforms. Now containers name MR::Allocator<T> everywhere; only its base differs (mi_stl_allocator or std::allocator). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
mrbind's parser aborted with "Duplicate class name: MR::Allocator<M>"; the bindings only need it as a template argument of containers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
So it no longer pulls mimalloc.h into every file; MRPch/MRHashMap.h, the one header including phmap, includes MRAllocator.h for the definition. MRAllocator.h includes config.h, not MRMeshFwd.h, because the shared PCH must not see MRMESH_API that early. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Blocks names MR::Allocator on all platforms now, so the C bindings generated in the Emscripten image match the native builds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Grantim
approved these changes
Oct 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
HashSet<T>andHashMap<K, V>(and soFaceHashSet,VertHashMap,WholeEdgeHashMapand the rest) now allocate throughMR::Allocator, likeBitSetblocks since #7240: mimalloc explicitly, orstd::allocatorin Emscripten builds and withMRMESH_NO_MIMALLOC.MRMeshFwd.hforward-declaresMR::Allocatorfor the aliases;MRPch/MRHashMap.h, the one header that includes phmap, includesMRAllocator.hfor its definition.MRAllocator.hnow includesconfig.hinstead ofMRMeshFwd.h, because the shared precompiled header must not seeMRMESH_APIthat early.MR::Allocator<T>is now a class template deriving frommi_stl_allocator<T>orstd::allocator<T>, instead of an alias for one of them, andMR_BIND_IGNORE: the bindings only see it as a template argument of containers. The C bindings are generated once, in the Emscripten image, and compiled on every platform. With the alias they spelledphmap::flat_hash_map<K, V>(Emscripten'sstd::allocator), which did not matchMR::HashMapon native platforms. Now every container type namesMR::Allocator<...>on all platforms.BitSet::bits()andBitSet::fromBlocksare bound again: they were hidden in BitSet blocks with the dependencies' non-override mimalloc; one mimalloc per process #7240 for the same Emscripten-vs-native allocator mismatch, not because mrbind ignores custom allocators.ParallelHashSet/ParallelHashMapare unchanged.Checked locally: MRMesh, MRVoxels and MRViewer build with MSVC with no warnings, and in a test exe without malloc override,
BitSet,HashMap(also a copy) andHashSetstorage is in the mimalloc heap while plainmallocis not.🤖 Generated with Claude Code