PDA

View Full Version : QSound Memory leak



bmyu
24th March 2014, 16:58
When uses QSound::play(..)

memory usages increase, and after playing, it decrase but, some of memory still remains.

Any solution?

wysota
24th March 2014, 17:39
That's probably not a memory leak. How are you measuring memory usage?

bmyu
24th March 2014, 17:43
Thanks to reply.

By Window Process Manager.

for (int i = 0; i < 10000; i ++) {
QSound *sound = new QSound("file");
delete sound;
(Or QSound::play("file");)
}

result :: About 8,000K~9,000K memory incrase and never decrase.

wysota
24th March 2014, 17:45
Windows Process Manager is not an accurate tool to measure memory usage :)

bmyu
24th March 2014, 17:49
That means, actually there's no memory leak after done and Windows Process Manager's memory usage is something like 'delusion'?

If then, how to measure usage properly?

wysota
24th March 2014, 17:52
You'd have to use tools dedicated for tracing memory leaks.

derhexer
24th March 2014, 18:04
I'm using "Visual Leak Detector" for Visual Studio. VLD is open source and works fine!
Is surly better than watch the process manager ;)

http://vld.codeplex.com/

A simple include in main.cpp is all you have to do. Every memory leak will be visible...

#ifdef _DEBUG
#define _ENABLE_VISUAL_LEAK_DETECTOR
#endif // _DEBUG
#ifdef _ENABLE_VISUAL_LEAK_DETECTOR
#include "vld.h"
#endif // _ENABLE_VISUAL_LEAK_DETECTOR