c++11d some loops. trying to fix supposed valgrind memory leak, though likely ok