0
0

Hi,

There appears to be a 40-byte memory leak the fsbank library.

All you should need to do to reproduce is call:

FSBank_Init();

FSBank_Close();

Then you should should see a 40-byte memory leak. Not sure if it helps, but for me, it’s the 69th call that FSBank_Init makes to the allocator which is being leaked.

I’m using fmodex version 4.04.51 on win32.

-sam

  • You must to post comments
0
0

[quote="samc":1ce7nyd2]Hi,

There appears to be a 40-byte memory leak the fsbank library.

All you should need to do to reproduce is call:

FSBank_Init();

FSBank_Close();

Then you should should see a 40-byte memory leak. Not sure if it helps, but for me, it’s the 69th call that FSBank_Init makes to the allocator which is being leaked.

I’m using fmodex version 4.04.51 on win32.

-sam[/quote:1ce7nyd2]

Bumping this thread because this is still happening to me with version 4.07.05. I realize it’s low priority because it’s only 40 bytes, but it would be nice if it could be fixed at some point.

thank you,
sam

  • You must to post comments
0
0

Hi, i’ll look into this.

  • You must to post comments
0
0

ok i just tested this with the latest fsbank and there is no leak that comes from fmod.

  • You must to post comments
0
0

I’ve upgraded to fmod version 4.06.20 and I’m still seeing this memory leak.. So either I’m doing something wrong/stupid in my program, or you never fixed the bug or else the bug has snuck back in.

Here is a test program that I threw together to test this:

[code:27ihmlpj]
// fmodtest.cpp : Defines the entry point for the console application.
//

include "stdafx.h"

include <assert.h>

include "fmod.h"

include "fmod_errors.h"

include "fsbanklib.h"

struct TrackMemory
{
void* ptr;
unsigned int size;
};

define MEMORY_TRACK_SIZE 10000

TrackMemory gTrackMemoryArray[MEMORY_TRACK_SIZE];

unsigned int gTotalMemAlloced = 0;

//////////////////////////////////////////////////////////////////////////
// Override for fmod memory manager
static void* F_CALLBACK sAllocMem(
unsigned int size,
FMOD_MEMORY_TYPE eType)
{
void* ptr = malloc(size);

for (int i=0; i&lt;MEMORY_TRACK_SIZE; i++)
{
    if ( gTrackMemoryArray[i].ptr == NULL )
    {
        gTrackMemoryArray[i].ptr = ptr;
        gTrackMemoryArray[i].size = size;
        gTotalMemAlloced += size;
        break;
    }
}
return ptr;

}

//////////////////////////////////////////////////////////////////////////
// Override for fmod memory manager
static void* F_CALLBACK sReallocMem(
void* ptr,
unsigned int size,
FMOD_MEMORY_TYPE eType)
{
for (int i=0; i<MEMORY_TRACK_SIZE; i++)
{
if ( gTrackMemoryArray[i].ptr == ptr )
{
gTotalMemAlloced += size – gTrackMemoryArray[i].size;
gTrackMemoryArray[i].size = size;
break;
}
}

return realloc(ptr, size);

}

//////////////////////////////////////////////////////////////////////////
// Override for fmod memory manager
static void F_CALLBACK sFreeMem(
void* ptr,
FMOD_MEMORY_TYPE eType)
{
for (int i=0; i<MEMORY_TRACK_SIZE; i++)
{
if ( gTrackMemoryArray[i].ptr == ptr )
{
gTotalMemAlloced -= gTrackMemoryArray[i].size;
gTrackMemoryArray[i].ptr = NULL;
gTrackMemoryArray[i].size = 0;
break;
}
}

free(ptr);

}

int _tmain(int argc, _TCHAR* argv[])
{
FMOD_RESULT result;

result = FMOD_Memory_Initialize( NULL, 0, sAllocMem, sReallocMem, sFreeMem );
assert(result == FMOD_OK);

FMOD_SYSTEM*    ptFModSystem;

result = FMOD_System_Create( &amp;ptFModSystem );
assert(result == FMOD_OK);

result = FMOD_System_SetSoftwareFormat(ptFModSystem, 44100, FMOD_SOUND_FORMAT_PCM16, 0, 2, FMOD_DSP_RESAMPLER_SPLINE);
assert(result == FMOD_OK);

result = FMOD_System_SetHardwareChannels(ptFModSystem, 0, 0, 0, 0);
assert(result == FMOD_OK);

result = FMOD_System_Init(ptFModSystem, 24, FMOD_INIT_NORMAL, NULL);
assert(result == FMOD_OK);

printf(&quot;Total memory allocated: %d\n&quot;, gTotalMemAlloced);

while(1)
{
    unsigned int mem_alloc_start = gTotalMemAlloced;

    FSBank_Init();
    FSBank_Close();

    printf(&quot;Total memory allocated: %d, %d bytes leaked\n&quot;, gTotalMemAlloced, gTotalMemAlloced - mem_alloc_start);
}

return 0;

}

[/code:27ihmlpj]

And here is the output that I get from a sample run:

[code:27ihmlpj]
Total memory allocated: 223821
Total memory allocated: 223861, 40 bytes leaked
Total memory allocated: 232125, 40 bytes leaked
Total memory allocated: 232165, 40 bytes leaked
Total memory allocated: 232205, 40 bytes leaked
Total memory allocated: 232245, 40 bytes leaked
Total memory allocated: 232285, 40 bytes leaked
Total memory allocated: 232325, 40 bytes leaked
Total memory allocated: 232365, 40 bytes leaked
Total memory allocated: 232405, 40 bytes leaked
Total memory allocated: 232445, 40 bytes leaked
Total memory allocated: 232485, 40 bytes leaked
Total memory allocated: 232525, 40 bytes leaked
Total memory allocated: 232565, 40 bytes leaked
Total memory allocated: 232605, 40 bytes leaked
Total memory allocated: 232645, 40 bytes leaked
Total memory allocated: 232685, 40 bytes leaked
Total memory allocated: 232725, 40 bytes leaked
Total memory allocated: 232765, 40 bytes leaked
Total memory allocated: 232805, 40 bytes leaked
Total memory allocated: 232845, 40 bytes leaked
Total memory allocated: 232885, 40 bytes leaked
Total memory allocated: 232925, 40 bytes leaked
Total memory allocated: 232965, 40 bytes leaked
Total memory allocated: 233005, 40 bytes leaked
Total memory allocated: 233045, 40 bytes leaked
Total memory allocated: 233085, 40 bytes leaked
Total memory allocated: 233125, 40 bytes leaked
Total memory allocated: 233165, 40 bytes leaked
Total memory allocated: 233205, 40 bytes leaked
Total memory allocated: 233245, 40 bytes leaked
Total memory allocated: 233285, 40 bytes leaked
Total memory allocated: 233325, 40 bytes leaked
Total memory allocated: 233365, 40 bytes leaked
Total memory allocated: 233405, 40 bytes leaked
Total memory allocated: 233445, 40 bytes leaked
Total memory allocated: 233485, 40 bytes leaked
Total memory allocated: 233525, 40 bytes leaked
Total memory allocated: 233565, 40 bytes leaked
Total memory allocated: 233605, 40 bytes leaked
Total memory allocated: 233645, 40 bytes leaked
[/code:27ihmlpj]

Am I doing something wrong in my test program, or is this a legitimate memory leak? Any help would be appreciated.

thanks,
sam

  • You must to post comments
0
0

Anyone available to look into this possible memory leak?

-sam

  • You must to post comments
0
0

This was fixed in 4.06.21.

  • You must to post comments
Showing 6 results
Your Answer

Please first to submit.