Results 1 to 5 of 5

Thread: SoundBuffer related memory problem

  1. #1

    Default SoundBuffer related memory problem

    hi,

    Im having a hard time trying to recognize where a memory leak related to soundBuffers is happening.. Im not creating my soundBuffer variables as pointers, I only use the prepare() method.. and still if I run UMDH it will tell me every time a sound is played in my game memory is leaking.. does anyone have a clue on how to fix this???

    Im attaching the report generated by UMDH, just in case it will help explain my problem better.. Thanx in advance..

    Cheers,
    eduardo...
    Attached Files Attached Files

  2. #2
    ClanLib Developer
    Join Date
    Sep 2006
    Location
    Denmark
    Posts
    554

    Default

    There are three possible explanations for those leaks:

    1. CL_SoundProvider_Vorbis_Session is never destroyed (by clanSound)
    2. We use vorbis_synthesis and other vorbis functions incorrectly
    3. The version of libvorbis used leaks memory


    There are two factors which decide whether clanSound destroys the CL_SoundProvider_Vorbis_Session object:

    • The application must not have any references to it. That is, it must not have any CL_SoundBuffer_Session objects that points to it
    • The session object must not currently be playing


    You could try see if the session object gets released by setting up a breakpoint in the CL_SoundProvider_Vorbis_Session destructor, or by adding some kind of logging text message output in it.

    If the destructor is never called, the leak is either that you keep a CL_SoundBuffer_Session object around, or a general bug in clanSound. If the destructor is called, then there is something wrong with how that class uses the libvorbis functions - or there is a leak in libvorbis.

  3. #3
    ClanLib Developer
    Join Date
    Sep 2006
    Location
    Denmark
    Posts
    554

    Default

    Btw. I looked at the rest of the report1.txt and from what I can tell, there is no leak of the CL_SoundProvider_Vorbis_Session object itself.

    This means that the destructor is most likely being called, and so the leak must be caused by this class using libvorbis incorrectly, or there is an actual memory leak in libvorbis.

    If you aren't using the very latest version of libvorbis, my first step would be to try download the newest version, recompile and see if that solves your problem.

  4. #4
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default

    In ClanLib-0.8/Sources/Vorbis/soundprovider_vorbis_session.cpp, at line 180, you should find these lines:

    Code:
    	vorbis_block_clear(&vb);
    	vorbis_dsp_clear(&vd);
    	vorbis_info_clear(&vi);  /* must be called last */
    Can you try adding: vorbis_comment_clear(&vc) as follows:

    Code:
    	vorbis_block_clear(&vb);
    	vorbis_dsp_clear(&vd);
    	vorbis_comment_clear(&vc);
    	vorbis_info_clear(&vi);  /* must be called last */
    Thanks

  5. #5

    Default

    I added the line to soundprovider_vorbis_session.cpp and it worked perfectly.. thanks guys!!!!

Similar Threads

  1. Adventure game related
    By Uhfgood in forum Novashell Game Creation System
    Replies: 4
    Last Post: 09-28-2009, 04:05 PM
  2. Video Memory
    By EdK in forum Official ClanLib SDK Forums
    Replies: 2
    Last Post: 06-14-2008, 08:39 PM
  3. Big memory leak in CL_PNGProvider::save
    By FluXy in forum Official ClanLib SDK Forums
    Replies: 1
    Last Post: 05-01-2008, 03:12 PM
  4. newbie memory management
    By celtx in forum Official ClanLib SDK Forums
    Replies: 0
    Last Post: 11-09-2007, 12:13 PM
  5. Memory Leaks
    By in forum Funeral Quest
    Replies: 9
    Last Post: 03-06-2007, 11:00 AM

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •