Commit 71eb7b8e authored by Leif Walsh's avatar Leif Walsh

added passthrough scoped_malloc impl for osx #160

osx doesn't support __thread well so scoped_malloc breaks it.  Rather than
fix it, we implement a correct but poorly-performing implementation for
now that will be used on osx machines.

fixes #160
parent af613c4e
......@@ -95,6 +95,29 @@ PATENT RIGHTS GRANT:
#include <util/scoped_malloc.h>
// The __thread storage class modifier isn't well supported on osx, but we
// aren't worried about the performance on osx, so we provide a
// pass-through implementation of scoped mallocs.
#ifdef __APPLE__
namespace toku {
scoped_malloc::scoped_malloc(const size_t size)
: m_size(size),
m_local(false),
m_buf(toku_xmalloc(size)) {}
scoped_malloc::~scoped_malloc() {
toku_free(m_buf);
}
} // namespace toku
void toku_scoped_malloc_init(void) {}
void toku_scoped_malloc_destroy(void) {}
#else // __APPLE__
namespace toku {
// see pthread_key handling at the bottom
......@@ -196,3 +219,5 @@ void toku_scoped_malloc_destroy(void) {
int r = pthread_key_delete(toku::tl_stack_destroy_pthread_key);
invariant_zero(r);
}
#endif // !__APPLE__
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