Q:

Thread does not free memory

I have a memory leak in my program.
Somewhere in my code I perform a long operation in a thread. In the meantime, I display a "waiting animation". The long operation consumes a lot of memory (~800 Mo). When the operation is finished, I expect the memory to be released, but it is not, and I don't know why. I tried to del the thread, as well as the deleteLater function.
Could you give me a hand please ?
How I call the thread:
self.predictor = Predictor(some arguments)

def whenDone():

    # ...do some stuff...

    self.predictor.deleteLater()
    del self.predictor

self.predictor.finished.connect(whenDone)
self.predictor.start()

My Thread class:
class Predictor(QtCore.QThread):

    def __init__(self, some arguments):

        QtCore.QThread.__init__(self)

    def __del__(self):

        """Method to destroy the thread properly"""

        self.wait()

    def run(self):

        # ...do some very long stuff...

A:

Monitoring memory usage can be tricky. Modern OS may chose to never decrease the memory pages allocated (and counted in tools such as top) for a process. This doesn't mean the application leaks though - it can free memory, and re-allocate this without further increase in memory footprint.

