From b6321dc91cc92b6e0a436aaf8d1ebf5f200ab6db Mon Sep 17 00:00:00 2001 From: gmega Date: Fri, 17 Nov 2023 20:17:29 -0300 Subject: [PATCH] revert memory leak fix so we can run tests with new DHT --- codex/utils/asyncprofiler/asyncprofiler.nim | 2 - .../utils/asyncprofiler/testasyncprofiler.nim | 40 +++++++++---------- 2 files changed, 20 insertions(+), 22 deletions(-) diff --git a/codex/utils/asyncprofiler/asyncprofiler.nim b/codex/utils/asyncprofiler/asyncprofiler.nim index 892ca12e..2f4b05ff 100644 --- a/codex/utils/asyncprofiler/asyncprofiler.nim +++ b/codex/utils/asyncprofiler/asyncprofiler.nim @@ -124,8 +124,6 @@ proc handleFutureComplete*[TFutureBase](self: var AsyncProfiler[TFutureBase], self.futureSummaryMetrics.withValue(loc, metric): metric[].addRun(runMetrics) - self.perFutureMetrics.del(fut.id) - if not isNil(self.onChange): self.onChange() diff --git a/tests/codex/utils/asyncprofiler/testasyncprofiler.nim b/tests/codex/utils/asyncprofiler/testasyncprofiler.nim index 06f681be..2ab4bef2 100644 --- a/tests/codex/utils/asyncprofiler/testasyncprofiler.nim +++ b/tests/codex/utils/asyncprofiler/testasyncprofiler.nim @@ -1,31 +1,31 @@ -import pkg/asynctest -import pkg/chronos +# import pkg/asynctest +# import pkg/chronos -import pkg/codex/utils/asyncprofiler +# import pkg/codex/utils/asyncprofiler -type - FakeFuture = object - id: uint - internalLocation*: array[LocationKind, ptr SrcLoc] +# type +# FakeFuture = object +# id: uint +# internalLocation*: array[LocationKind, ptr SrcLoc] -suite "asyncprofiler": +# suite "asyncprofiler": - test "should not keep metrics for a pending future in memory after it completes": +# test "should not keep metrics for a pending future in memory after it completes": - var fakeLoc = SrcLoc(procedure: "foo", file: "foo.nim", line: 1) - let future = FakeFuture( - id: 1, - internalLocation: [ - LocationKind.Create: addr fakeLoc, - LocationKind.Finish: addr fakeLoc, - ]) +# var fakeLoc = SrcLoc(procedure: "foo", file: "foo.nim", line: 1) +# let future = FakeFuture( +# id: 1, +# internalLocation: [ +# LocationKind.Create: addr fakeLoc, +# LocationKind.Finish: addr fakeLoc, +# ]) - var profiler = AsyncProfiler[FakeFuture]() +# var profiler = AsyncProfiler[FakeFuture]() - profiler.handleFutureCreate(future) - profiler.handleFutureComplete(future) +# profiler.handleFutureCreate(future) +# profiler.handleFutureComplete(future) - check len(profiler.getPerFutureMetrics()) == 0 +# check len(profiler.getPerFutureMetrics()) == 0