Closed plusEight closed 9 years ago
Mike said he is only concerned with "definitely lost" and major errors
Thanks
This happens sometimes when the objects themselves allocate heap memory. They do this if size is unknown at compile time, and valgrind is somewhat cautious. If the amounts were very large, it could be compensated for by manually shrinking the buffers of those objects. String and vector have both clear and shrink_to_fit options in C++11 and I think a couple of the prior standards.
Running valgrind on my executable reveals that I have 70 bytes possibly lost. I tried to interpret what I could from valgrind and it looks like it is finding issues within the following functions
main workcommand filterstr
filterstr is called within my workcommand function, which is called in my main. So I believe that filterstr might be the culprit for memory leaks in all three functions. However, I cannot seem to find anything that might relate to memory issues in that function.
Any idea where the leaks are coming from?
Here is the report with tags --leak-check=full bin/rshell used.
filterstr's job returns a filtered string that eliminates all excess spaces from the beginning or end of the userinput. If it finds connectors at the beginning or end of userinput, it returns an empty string and gives the user an error.
Lastly, it reformats all connectors in the userinput string so I can easily parse them later.