Skip to content

Commit 2764f44

Browse files
authored
Merge pull request #936 from beetleskin/fix/use_fastdefaultallocator_for_values
2 parents fa28bbb + bdbd9ad commit 2764f44

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

gtsam/nonlinear/Values.h

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
#pragma once
2626

27+
#include <gtsam/base/FastDefaultAllocator.h>
2728
#include <gtsam/base/GenericValue.h>
2829
#include <gtsam/base/VectorSpace.h>
2930
#include <gtsam/inference/Key.h>
@@ -62,17 +63,18 @@ namespace gtsam {
6263
class GTSAM_EXPORT Values {
6364

6465
private:
65-
6666
// Internally we store a boost ptr_map, with a ValueCloneAllocator (defined
67-
// below) to clone and deallocate the Value objects, and a boost
68-
// fast_pool_allocator to allocate map nodes. In this way, all memory is
69-
// allocated in a boost memory pool.
67+
// below) to clone and deallocate the Value objects, and our compile-flag-
68+
// dependent FastDefaultAllocator to allocate map nodes. In this way, the
69+
// user defines the allocation details (i.e. optimize for memory pool/arenas
70+
// concurrency).
71+
typedef internal::FastDefaultAllocator<typename std::pair<const Key, void*>>::type KeyValuePtrPairAllocator;
7072
typedef boost::ptr_map<
7173
Key,
7274
Value,
7375
std::less<Key>,
7476
ValueCloneAllocator,
75-
boost::fast_pool_allocator<std::pair<const Key, void*> > > KeyValueMap;
77+
KeyValuePtrPairAllocator > KeyValueMap;
7678

7779
// The member to store the values, see just above
7880
KeyValueMap values_;

0 commit comments

Comments
 (0)