Closed RanniSch closed 10 months ago
well the thing is, we cannot test it proper, because our server is running infinite. When we press ctrl + c then we end valgrind, not directly our server. I don't know how valgrind is terminating our webserve. Fact is we don't have any new keyword and no malloc in the whole code. We work with our variables on the stack. What they do in the background (allocate memory on the heap or not is not ours) (besides throwing an bad::alloc, we have to catch that... I did not do it, not good). And till we end valgrind we have no lost memory, so no indication for memory leaks.
@MaxIhme I would not agree on that. Lost memory is only shown at the end of valgrind. Vangrind never shows before.
Magic happend. I redid the test with "valgrind --leak-check=full --show-leak-kinds=all ./webserv" http://localhost:8000/cgi-bin/script-get-2.py
and now the Errors are gone, only "reachable memory" is an issue:
If I open two different ports, I sometimes get 1 Error.
It's perfect now
Tested with: valgrind --leak-check=full --show-leak-kinds=all ./webserv
simple Test with: http://localhost:8000/cgi-bin/script-get-2.py (same results with other tests)
LEAK SUMMARY: ==4819== definitely lost: 0 bytes in 0 blocks ==4819== indirectly lost: 0 bytes in 0 blocks ==4819== possibly lost: 0 bytes in 0 blocks ==4819== still reachable: 24,759 bytes in 377 blocks ==4819== suppressed: 0 bytes in 0 blocks ==4819== ==4819== For lists of detected and suppressed errors, rerun with: -s ==4819== ERROR SUMMARY: 3 errors from 2 contexts (suppressed: 0 from 0)
Problem: Terminal does not show the first error anymore. It looks like that the leaks (or some of them) are in the Config Class. Maybe in a vector there.