Commit 32fe2132 authored by Marius Wachtler's avatar Marius Wachtler

pyston::DenseMap use PyObject_Malloc

it is slighlty faster for small allocations and has the advantage that it is easier to track how much memory our python objects are using
parent e4a492a6
......@@ -50,6 +50,9 @@
#include "llvm/Support/PointerLikeTypeTraits.h"
#include "llvm/Support/type_traits.h"
// Pyston change: use the python allocator
#include "Python.h"
namespace pyston {
// This should only take effect for this header file:
......@@ -721,6 +724,10 @@ private:
Buckets = static_cast<BucketT*>(operator new(sizeof(BucketT) * NumBuckets));
return true;
}
// Pyston change: use the python allocator
static void* operator new(size_t count) { return PyObject_Malloc(count); }
static void operator delete(void* p) { PyObject_Free(p); }
};
template <typename KeyT, typename ValueT, unsigned InlineBuckets = 4,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment