Yesterday I solved delete the middle node of a linked-list question. I implemented the same algorithm in C++ and python, but the results surprised me, here's the result of python code:

and the result of C++ code:

As you can see, C++ code memory usage is high than the code written in python. I'm leaving both implementations:
python

C++

Why is the C++ implementation using so much memory?
(IMHO: I think the problem is with tests, test code may not release used memory)
P.S: sorry my english is bad...