The operating system holds the memory assigned to the process for future use. If some other process allocates a big chunk of memory, the memory will be freed and reassigned to it. That's totally normal behaviour.
If you use QSharedPointer then you can see if the memory is released by setting a deleter callback while creating the shared pointer and writing some debug statement in the deleter to see how many times it gets called.
As a side note, I don't see the point of using QSharedPointer in your situation. You should allocate your objects on the stack and not on the heap if that's just the result of an sql query. Then you wouldn't have such problems.
Bookmarks