Hi,
I tried out your C++ libraries and noticed an increasing RAM consumption. So I run Valgrind on a minimal example:
#include "../../IsoSpec++/isoSpec++.h"
int main() {
auto orderedGenerator = IsoSpec::IsoOrderedGenerator("H2O1");
orderedGenerator.advanceToNextConfiguration();
}
This is the result:
$ valgrind --tool=memcheck --gen-suppressions=all --leak-check=full --leak-resolution=med --track-origins=yes --vgdb=no code/IsoSpec/Examples/C++/example
==79253== Memcheck, a memory error detector
==79253== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==79253== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info
==79253== Command: code/IsoSpec/Examples/C++/example
==79253==
==79253==
==79253== HEAP SUMMARY:
==79253== in use at exit: 256 bytes in 2 blocks
==79253== total heap usage: 58 allocs, 56 frees, 211,304 bytes allocated
==79253==
==79253== 256 bytes in 2 blocks are definitely lost in loss record 1 of 1
==79253== at 0x483B723: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==79253== by 0x483E017: realloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==79253== by 0x12DD61: unsafe_pod_vector<IsoSpec::ProbAndConfPtr>::fast_reserve(unsigned long) (pod_vector.h:263)
==79253== by 0x11A05C: push_back (pod_vector.h:309)
==79253== by 0x11A05C: IsoSpec::MarginalTrek::add_next_conf() (marginalTrek++.cpp:418)
==79253== by 0x119634: IsoSpec::MarginalTrek::MarginalTrek(IsoSpec::Marginal&&, int, int) (marginalTrek++.cpp:346)
==79253== by 0x116A03: IsoSpec::IsoOrderedGenerator::IsoOrderedGenerator(IsoSpec::Iso&&, int, int) (isoSpec++.cpp:824)
==79253== by 0x110447: main (water.cpp:38)
==79253==
{
<insert_a_suppression_name_here>
Memcheck:Leak
match-leak-kinds: definite
fun:malloc
fun:realloc
fun:_ZN17unsafe_pod_vectorIN7IsoSpec14ProbAndConfPtrEE12fast_reserveEm
fun:push_back
fun:_ZN7IsoSpec12MarginalTrek13add_next_confEv
fun:_ZN7IsoSpec12MarginalTrekC1EONS_8MarginalEii
fun:_ZN7IsoSpec19IsoOrderedGeneratorC1EONS_3IsoEii
fun:main
}
==79253== LEAK SUMMARY:
==79253== definitely lost: 256 bytes in 2 blocks
==79253== indirectly lost: 0 bytes in 0 blocks
==79253== possibly lost: 0 bytes in 0 blocks
==79253== still reachable: 0 bytes in 0 blocks
==79253== suppressed: 0 bytes in 0 blocks
==79253==
==79253== For lists of detected and suppressed errors, rerun with: -s
==79253== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
So there is a leak.
Running this:
#include "../../IsoSpec++/isoSpec++.h"
int main() {
auto orderedGenerator = IsoSpec::IsoThresholdGenerator("H2O1", 0.01);
orderedGenerator.advanceToNextConfiguration();
}
Works fine.
Also the example of water.cpp seems to be ok. So what am I doing wrong? I hope you can help me.
Thanks for the report - commit ID 2dad383df9c2927f1b4993c92adb6114c60fcb58 should fix this. Closing for now; feel free to reopen this issue if it's noth the case for you.
Hi, I tried out your C++ libraries and noticed an increasing RAM consumption. So I run Valgrind on a minimal example:
This is the result:
So there is a leak.
Running this:
Works fine.
Also the example of water.cpp seems to be ok. So what am I doing wrong? I hope you can help me.