0
0

Hello, I am staring with this wonderfull lib, I have added this with our engine flawless, but I have found a little memory leak.

I have tested it using our “in-house” memory functions and using default memory allocation function, and this leak happends when FSOUND_Sample_Load, [b:10bisgea]FAILS[/b:10bisgea] worth mention that this leak dose not occurs if FSOUND_Sample_Load succeed.

I am using a very simple test where I init FMOD, load a wav file in a temporal buffer (mainly because our engine need UNICODE support),
load the sample (managed one), and close FMOD.
[code:10bisgea]

FSOUND_Init(44100, 32, FSOUND_INIT_GLOBALFOCUS);
sample = FSOUND_Sample_Load(FSOUND_FREE, buffer, (FSOUND_LOADMEMORY | FSOUND_HW3D), 0, size);
FSOUND_Close();

[/code:10bisgea]

By other hand, regarding to FSOUND_Sample_Load, is it correct to use the following settings (im using this and works fine):

(FSOUND_LOADMEMORY | FSOUND_HW3D | FSOUND_HW2D | FSOUND_2D)

I ask this beacuse if I use FSOUND_LOADMEMORY | FSOUND_HW3D, the
FSOUND_Sample_Load fails if no hardware support, so I “ASSUME” that using the above settings FMOD fallsback to 2D software mode?

Thanks in advance,
Oscar

PS: Im using FMOD 3.74 (the one available from download page) on Windows XP SP2.

  • You must to post comments
0
0

Hi, thanks for yor fast replay.

Well I tested with the 3.75 but the leak still happends.

One thing I noticed is that [b:3fzuwomr]it dose not present [/b:3fzuwomr][b:3fzuwomr]ALWAYS[/b:3fzuwomr] when FSOUND_Sample_Load fails, it just happend when FSOUND_Sample_Load fails using the [b:3fzuwomr]FSOUND_HW3D[/b:3fzuwomr], I mean, if load function fails because a incorrect file name, the leak dose not occurs:

Here are 2 cases which present the leak:

Using the buffer method:
[code:3fzuwomr]
sample = FSOUND_Sample_Load(FSOUND_FREE, buffer, (FSOUND_LOADMEMORY | FSOUND_HW3D), 0, size);
[/code:3fzuwomr]

Or loading a normal file:
[code:3fzuwomr]
sample = FSOUND_Sample_Load(FSOUND_FREE, "C:\GameProjects\Game\exe\game\sfx\score_up.wav", FSOUND_HW3D, 0, 0);
[/code:3fzuwomr]

This cause our memory manager report a block of about 32 bytes (because aligned data), or using default memory alloc functions, FSOUND_GetMemoryStats, report a leak of about 12 bytes.

So as you see is a [b:3fzuwomr]very specific case[/b:3fzuwomr] which cause the leak, and maybe is just because I am using the wrong mode (plain FSOUND_HW3D),
so for now I will just keep using FSOUND_HW2D as we only need 2D sounds. Regarding this [b:3fzuwomr]FSOUND_HW2D[/b:3fzuwomr] mode, should I include the FSOUND_2D too, or if it fails, fallbacks to software mode, I ask this because our target audience is mainly casual gamers with OLD computers
(Our min specs are PII-350 machines).

Regards,
Oscar

  • You must to post comments
0
0

Well, I have tried the method you suggest me and I keep a difference of about 424 bytes in current, max remains the same size in both calls to FSOUND_GetMemoryStats.

One thing I noted is that if I use FSOUND_SetOutput(FSOUND_OUTPUT_WINMM);, the use of [b:2fxxliuj]FSOUND_HW3D[/b:2fxxliuj] dont cause a FSOUND_Sample_Load to fail, so the leak do not presents here.

By other hand in your test, the leak seems not be happening (as the curr and max stay the same), so maybe could be a DSound driver bug?

EDITED: Well using your test method, if the cause because FSOUND_Sample_Load fails, is by a BAD NAME (Ej: it dose not exist), the current and max remains the same. This leak seems to just happen when I receive the “Error creating hardware sound buffer.” error message using the FSOUND_HW3D with DSound driver.

Oscar

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.