Re: memory leaking in mad_layer_III?
Niels Roosen <[email protected]> Wed, 26 Sep 2007 23:55:04 +0200
| Newsgroups | gmane.comp.audio.mad.devel |
|---|---|
| Message-ID | <[email protected]> |
Rob Leslie wrote: > On Sep 26, 2007, at 3:40 AM, Niels Roosen wrote: >> Am I missing something or could it be that using mad this way hasn't >> been tested excessively enough and is it true that the memory >> alllocated in mad_layer_III() on lines 2530 and 2538 (libmad version >> 0.15.1b) is not freed properly? I would be delighted to either get >> confirmation on this or some advice on how to solve this issue. > > The memory allocated in mad_layer_III() is freed in mad_frame_finish() > and mad_stream_finish(); you should make sure these are definitely being > called on the same structures you pass to mad_frame_decode(). > > Since you say you are making these calls, I'm at a loss to offer any > specific advice without seeing your code. What I do is initialize the decoder, decode incoming data per frame until the client disconnects, and then, when another client connects, run the mad_stream_finish() and mad_frame_finish() on the pointers to the relevant structures before running the initialization functions again, in order to clean up any remaining data in the decoder. I took this from some example code but unfortunately don't know what any more, but I suppose that is how it should be done. I will post the relevant code tomorrow, should I do that as attachment or inline? Regards, Niels -- "One of the most frightening things about your true nerd, for many people, is not that he's socially inept - because everybody's been there - but rather his complete lack of embarrassment about it." - Randy Waterhouse in Cryptonomicon n: Arnie / Arnicus | e: [email protected] w: http://okkernoot.net/ | irc: irc.okkernoot.net #geek | icq: 31817478 aim: arniea a arniea | msn: [email protected] http://jungletrain.net/ - 24/7 Drum and Bass Internet Radio