Skip to content

Commit

Permalink
Merge pull request #936 from beetleskin/fix/use_fastdefaultallocator_…
Browse files Browse the repository at this point in the history
…for_values
  • Loading branch information
varunagrawal authored Nov 22, 2021
2 parents fa28bbb + bdbd9ad commit 2764f44
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions gtsam/nonlinear/Values.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

#pragma once

#include <gtsam/base/FastDefaultAllocator.h>
#include <gtsam/base/GenericValue.h>
#include <gtsam/base/VectorSpace.h>
#include <gtsam/inference/Key.h>
Expand Down Expand Up @@ -62,17 +63,18 @@ namespace gtsam {
class GTSAM_EXPORT Values {

private:

// Internally we store a boost ptr_map, with a ValueCloneAllocator (defined
// below) to clone and deallocate the Value objects, and a boost
// fast_pool_allocator to allocate map nodes. In this way, all memory is
// allocated in a boost memory pool.
// below) to clone and deallocate the Value objects, and our compile-flag-
// dependent FastDefaultAllocator to allocate map nodes. In this way, the
// user defines the allocation details (i.e. optimize for memory pool/arenas
// concurrency).
typedef internal::FastDefaultAllocator<typename std::pair<const Key, void*>>::type KeyValuePtrPairAllocator;
typedef boost::ptr_map<
Key,
Value,
std::less<Key>,
ValueCloneAllocator,
boost::fast_pool_allocator<std::pair<const Key, void*> > > KeyValueMap;
KeyValuePtrPairAllocator > KeyValueMap;

// The member to store the values, see just above
KeyValueMap values_;
Expand Down

0 comments on commit 2764f44

Please sign in to comment.