I noticed my memory shrinking -- my RAM I mean... :)

It was causing all types of allocation problems when I clicked a few titles
one after another, errors I hadn't noticed before because I usually just
waited for the file to be loaded (they were on an NFS mount, but are local
now so I can now load the big files :P).

If I understand correctly, loading a song in a player causes the 'analyser
queue' to be filled up.

I notice the following code in AnalyserQueue::run():

     97     while (!m_exit) {
     98
     99         TrackInfoObject* next = dequeueNextBlocking();
    100
    101         // Get the audio
    102         SoundSourceProxy * pSoundSource = new
SoundSourceProxy(next);


I believe this while-loop lacks a 'delete' for this SoundSourceProxy object
that is getting created: the pointer would get overwritten without the
previous memory being freed.


And, shouldn't ''pSoundSource' be tested after trying to create the object?
As in something like:

        if (pSoundSource == NULL) continue;

The benefit would be that it would cause the errors caused by memory
problems to be "silently ignored" here rather than having the application
barfing in an unfriendly manner.  :)

(The same test is lacking for the value returned from dequeueNextBlocking()
-- but I guess, as the name of that routine suggest, that it always returns
a value and otherwise, well, "blocks" i.e. waits?)

Proposed fix is attached...
=== modified file 'mixxx/src/analyserqueue.cpp'
--- mixxx/src/analyserqueue.cpp	2009-03-09 07:40:20 +0000
+++ mixxx/src/analyserqueue.cpp	2009-11-18 14:18:14 +0000
@@ -100,6 +100,8 @@
         
         // Get the audio
         SoundSourceProxy * pSoundSource = new SoundSourceProxy(next);
+        if (pSoundSource == NULL) continue;
+
         int iNumSamples = pSoundSource->length();
         int iSampleRate = pSoundSource->getSrate();
 
@@ -117,6 +119,7 @@
 			itf.next()->finalise(next);
 		}
 
+        delete pSoundSource;
         emit(trackFinished(next));
 	}
 }

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Mixxx-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mixxx-devel

Reply via email to