diff --git a/drace-client/include/aligned-buffer.h b/drace-client/include/aligned-buffer.h index 71b31a9..3948176 100644 --- a/drace-client/include/aligned-buffer.h +++ b/drace-client/include/aligned-buffer.h @@ -83,9 +83,14 @@ namespace drace { // copy this as value is modified by std::align size_t space_size = _size_in_bytes; _mem = dr_thread_alloc(drcontext, _size_in_bytes); - data = (T*)std::align(alignment, capacity, _mem, space_size); + // std::align changes pointer to memspace, hence copy + void * mem_align = _mem; + DR_ASSERT_MSG( + std::align(alignment, capacity, mem_align, space_size) != nullptr, + "could not allocate aligned memory"); + data = (T*)mem_align; DR_ASSERT(((uint64_t)data % alignment) == 0); } } }; -} \ No newline at end of file +} diff --git a/drace-client/src/memory-tracker.cpp b/drace-client/src/memory-tracker.cpp index c9f4d51..af01e0c 100644 --- a/drace-client/src/memory-tracker.cpp +++ b/drace-client/src/memory-tracker.cpp @@ -273,6 +273,8 @@ namespace drace { data->stack.deallocate(drcontext); data->mem_buf.deallocate(drcontext); + hashtable_delete(&(data->mutex_book)); + // free statistics data->stats->~Statistics(); dr_thread_free(drcontext, data->stats, sizeof(Statistics));