-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Closed
Description
I was under the impression that failure in a a destructor will leak that object, but not the entire task.
"dropped" doesn't print here:
struct Dropper {
v: Vec<u8>,
}
impl Drop for Dropper {
fn drop(&mut self) {
println!("dropping");
}
}
struct Failer;
impl Drop for Failer {
fn drop(&mut self) {
fail!();
}
}
fn main() {
let _d = Dropper { v: Vec::with_capacity(10000) };
Failer;
}==6462== Memcheck, a memory error detector
==6462== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==6462== Using Valgrind-3.9.0 and LibVEX; rerun with -h for copyright info
==6462== Command: ./test
==6462==
task '<main>' failed at 'explicit failure', test.rs:15
==6462==
==6462== HEAP SUMMARY:
==6462== in use at exit: 12,288 bytes in 1 blocks
==6462== total heap usage: 14 allocs, 13 frees, 13,000 bytes allocated
==6462==
==6462== LEAK SUMMARY:
==6462== definitely lost: 12,288 bytes in 1 blocks
==6462== indirectly lost: 0 bytes in 0 blocks
==6462== possibly lost: 0 bytes in 0 blocks
==6462== still reachable: 0 bytes in 0 blocks
==6462== suppressed: 0 bytes in 0 blocks
==6462== Rerun with --leak-check=full to see details of leaked memory
==6462==
==6462== For counts of detected and suppressed errors, rerun with: -v
==6462== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 1 from 1)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Type
Fields
Give feedbackNo fields configured for issues without a type.