Closed mcamurri closed 3 years ago
This PR fixes a trivial memory leak.
Valgrind Before:
==12974== LEAK SUMMARY: ==12974== definitely lost: 0 bytes in 0 blocks ==12974== indirectly lost: 0 bytes in 0 blocks ==12974== possibly lost: 864 bytes in 2 blocks ==12974== still reachable: 108,923 bytes in 1,082 blocks ==12974== suppressed: 0 bytes in 0 blocks ==12974== ==12974== For counts of detected and suppressed errors, rerun with: -v ==12974== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0)
Valgrind After:
==13204== LEAK SUMMARY: ==13204== definitely lost: 0 bytes in 0 blocks ==13204== indirectly lost: 0 bytes in 0 blocks ==13204== possibly lost: 0 bytes in 0 blocks ==13204== still reachable: 58,262 bytes in 841 blocks ==13204== suppressed: 0 bytes in 0 blocks ==13204== ==13204== For counts of detected and suppressed errors, rerun with: -v ==13204== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
are you telling me I should stop using raw pointers?
:sob:
Either use raw pointers but remember to delete afterwards, or use unique_ptr and forget about that. The second option is recommended nowadays.
delete
unique_ptr
This PR fixes a trivial memory leak.
Valgrind Before:
Valgrind After: