Skip to content

deallocation done in different function can cause underflow #2

@trinity-1686a

Description

@trinity-1686a

applying this patch to the provided example:

diff --git a/examples/tracing.rs b/examples/tracing.rs
index ea3aa77..5475b15 100644
--- a/examples/tracing.rs
+++ b/examples/tracing.rs
@@ -40,6 +40,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
     // Wait for the task to complete
     let _result = task_1.await?;
     let _another_result = task_2.await?;
+    drop(_another_result);
 
     let _buff = function_which_allocates();

causes leaktracer to decrement the entry of main() instead of the entry of task() where the function got allocated, causing an underflow:

INFO tracing:49: Symbol: tracing::main::{{closure}}, Allocated: 18446744073709549568, Count: 18446744073709551615

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions