Memory leak from calling QResource::registerResource in my main() function?
-
Valgrind
says so ... do I have to explicitly unregister any resources which were previously registered by calling the static functionQResource::registerResource()
? None of the constructors of the QResource class provide for passing a parent object, either. -
It's a 'one-time' memory-leak - i.e. it's not cleaned up on application exit but it's not that big problem since the OS cleans up the memory by it's own. It's not nice but should not hurt either.
-
It's a 'one-time' memory-leak - i.e. it's not cleaned up on application exit but it's not that big problem since the OS cleans up the memory by it's own. It's not nice but should not hurt either.
@Christian-Ehrlicher Thanks, Christian. Nevertheless, I'd like to avoid it if possible. At least I now know that "it isn't me". I'll try avoiding the static functions and see if that makes a difference.
-
Hi,
Yes, you have to do it yourself with QResource:: unregisterResource.
Depending on how you are using your resources you could write a helper class like QMutexLocker
-
Hi,
Yes, you have to do it yourself with QResource:: unregisterResource.
Depending on how you are using your resources you could write a helper class like QMutexLocker
@SGaist Thanks ... I do call
unregisterResource
whenever I register another one, but I need to know at the end of themain()
function which one is active. So the helper class sounds like a good idea.