remove old memory tracker

This commit is contained in:
antoniofilipovic
2023-10-06 16:30:55 +02:00
parent ba1a9d3045
commit 771982be05
4 changed files with 4 additions and 30 deletions

View File

@@ -87,23 +87,13 @@ void deleteSized(void *ptr, const std::size_t /*unused*/, const std::align_val_t
#endif
void TrackMemory(std::size_t size) {
#if USE_JEMALLOC
if (size != 0) [[likely]] {
size = nallocx(size, 0);
}
memgraph::utils::old_jemalloc_total_memory_tracker.Alloc(static_cast<int64_t>(size));
#else
#if !USE_JEMALLOC
memgraph::utils::total_memory_tracker.Alloc(static_cast<int64_t>(size));
#endif
}
void TrackMemory(std::size_t size, const std::align_val_t align) {
#if USE_JEMALLOC
if (size != 0) [[likely]] {
size = nallocx(size, MALLOCX_ALIGN(align)); // NOLINT(hicpp-signed-bitwise)
}
memgraph::utils::old_jemalloc_total_memory_tracker.Alloc(static_cast<int64_t>(size));
#else
#if !USE_JEMALLOC
memgraph::utils::total_memory_tracker.Alloc(static_cast<int64_t>(size));
#endif
}
@@ -130,11 +120,7 @@ bool TrackMemoryNoExcept(const std::size_t size, const std::align_val_t align) {
void UntrackMemory([[maybe_unused]] void *ptr, [[maybe_unused]] std::size_t size = 0) noexcept {
try {
#if USE_JEMALLOC
if (ptr != nullptr) [[likely]] {
memgraph::utils::old_jemalloc_total_memory_tracker.Free(sallocx(ptr, 0));
}
#else
#if !USE_JEMALLOC
if (size) {
memgraph::utils::total_memory_tracker.Free(static_cast<int64_t>(size));
} else {
@@ -148,12 +134,7 @@ void UntrackMemory([[maybe_unused]] void *ptr, [[maybe_unused]] std::size_t size
void UntrackMemory(void *ptr, const std::align_val_t align, [[maybe_unused]] std::size_t size = 0) noexcept {
try {
#if USE_JEMALLOC
if (ptr != nullptr) [[likely]] {
memgraph::utils::old_jemalloc_total_memory_tracker.Free(
sallocx(ptr, MALLOCX_ALIGN(align))); // NOLINT(hicpp-signed-bitwise)
}
#else
#if !USE_JEMALLOC
if (size) {
memgraph::utils::total_memory_tracker.Free(static_cast<int64_t>(size));
} else {

View File

@@ -3069,8 +3069,6 @@ PreparedQuery PrepareSystemInfoQuery(ParsedQuery parsed_query, bool in_explicit_
{TypedValue("average_degree"), TypedValue(info.average_degree)},
{TypedValue("memory_usage"), TypedValue(static_cast<int64_t>(info.memory_usage))},
{TypedValue("disk_usage"), TypedValue(static_cast<int64_t>(info.disk_usage))},
// {TypedValue("old_jemalloc_memory_allocated"), TypedValue(utils::GetReadableSize(static_cast<double>(
// utils::old_jemalloc_total_memory_tracker.Amount())))},
// {TypedValue("jemalloc_memory_allocated"),
// TypedValue(utils::GetReadableSize(static_cast<double>(utils::total_memory_tracker.Amount())))},
{TypedValue("memory_allocated"), TypedValue(static_cast<int64_t>(utils::total_memory_tracker.Amount()))},

View File

@@ -44,8 +44,6 @@ bool MemoryTracker::OutOfMemoryExceptionBlocker::IsBlocked() { return counter_ >
MemoryTracker total_memory_tracker;
MemoryTracker old_jemalloc_total_memory_tracker;
// TODO (antonio2368): Define how should the peak memory be logged.
// Logging every time the peak changes is too much so some kind of distribution
// should be used.

View File

@@ -103,7 +103,4 @@ class MemoryTracker final {
// Global memory tracker which tracks every allocation in the application.
extern MemoryTracker total_memory_tracker;
// Global memory tracker which tracks every allocation in the application.
extern MemoryTracker old_jemalloc_total_memory_tracker;
} // namespace memgraph::utils