Memory leak in ShowMessageBox? |
brada
|
I'm not saying there *isn't* a leak, but the method you took to arrive at that conclusion is flawed.
Now I'm not a "Windows" guy, but I think its true for any OS that there are any number of non-leaky reasons why memory usage doesnt recede back to ~1.3. You need to use an actual profiling tool like Valgrind to check for actual leaks. |
|||||||||||
|
GenuineCorruption
|
Hello,
True it's not an extensive diagnostic test... but is there a reason why the message box feature should cause the application's memory usage to ascend without ever coming back down? I could totally see the first call resulting in some permanent memory usage if there was some initialization involved, but short of that I don't see why showing a message box would need to allocate memory and have it persist for the lifetime of the application. Admittedly I'm pretty green when it comes to lower level programming where memory management comes in to play, but I would suspect this has gone unnoticed due to the fact that a real-world need to show thousands of message boxes during the course of a multimedia application's lifetime doesn't exist in all but the most obscure of cases. |
|||||||||||
|
brada
|
it could be as simple as the memory manager (heap manager?) deciding its more efficient to let the process retain ownership of the memory in case it needs to do more allocations. if your system were starving for memory it probably would return the memory to the system. There are other reasons too I think, but really the point is that tests like this can often indicate leaks, but to actually know you should use a tool designed for detecting leaks (Valgrind). Operating systems are big complicated beasts where processes are caching things, getting messages from other processes, and who-knows-what-else without you (as both a user and a programmer) being aware.
maybe. I cant testify to what the SDL team does, but if they are regularly probing for leaks then all it takes is a single tiny leak to spot this. Of course that assumes they have a test which incorporates a message box. I havent checked out SDLs test suite, but I hear its pretty extensive. However, message boxes probably contain a fair amount of platform dependent code, so maybe it only leaks for Windows as you suggest. As I said before, I'm not saying there isn't a leak, just that somebody is going to have to fire up a Valgrindesque tool and check to both determine if there is one, and find what and where it is leaking. |
|||||||||||||||
|