"Failed allocating" errors

We’re seeing a significant number of errors on PS4, mostly in the form of:

Failed allocating e:\jk\workspace\Build__1.6rel__UE4Libs_PS4\lowlevel_api\src\fmod_output_software.cpp line 307. Wanted 76888 bytes, current 5651005/0

Failed allocating e:\jk\workspace\Build__1.6rel__UE4Libs_PS4\lowlevel_api\src\fmod_pluginfactory.cpp line 1298. Wanted 600 bytes, current 5689322/0

Failed allocating …\lowlevel_api\src\fmod_memory.h line 273. Wanted 1032 bytes, current 5689791/0

We figured that /0 is referring to poolmem/poollen in Memory_Initialize, but setting those variables doesn’t fix the issue. Are we using Memory_Initialize incorrectly, or is there another fix for this issue?


If you specify a pool memory pointer, it must have a length. Memory_Initialize would probably return an error if one was there without the other.
/0 to me looks like you’re not using any memory pool, and its just using the internal memory system, that is failing internally because external code is using up all of the memory?

We’ve tried setting poollen. I believe that the code we’re using is correct, but I believe the location is wrong. The Memory_Initialize documentation says that it “must be called before any FMOD System object is created”, but I don’t know when that is. If I call it too early, I get a prx error and crash. If I call it too late, it doesn’t seem to do anything. Do you know when Memory_Initialize should be called in UE4?

You should be able to add that call to Memory_Initialize after LoadLibraries() in FMODStudioModule.cpp

Hi Guys,

I recognise that this is quite old but we’ve encountered the same issue in a recent build. Is it enough to call Memory_Initialise like in the code sample below, or am I missing a vital step (or five)?

if (LoadLibraries())
FMOD_RESULT result = FMOD::Memory_Initialize(malloc(4 * 1024 * 1024), 4 * 1024 * 1024, 0, 0, 0);
// Create sandbox system just for asset loading

Out of the box UE4 Integration on PS4 will be backing onto system malloc which has limitations. Read more about the limitations and how to increase them at:

1 Like

The next release of the integration will have FMOD use the UE4 memory allocation system, so that should avoid the issue.

We’ve added new functions defined at the top of FMODStudioModule.cpp:

void* F_CALLBACK FMODMemoryAlloc(unsigned int size, FMOD_MEMORY_TYPE type, const char *sourcestr)
	return FMemory::Malloc(size);
void* F_CALLBACK FMODMemoryRealloc(void *ptr, unsigned int size, FMOD_MEMORY_TYPE type, const char *sourcestr)
	return FMemory::Realloc(ptr, size);
void F_CALLBACK FMODMemoryFree(void *ptr, FMOD_MEMORY_TYPE type, const char *sourcestr)

And then just after LoadLibraries, we tell FMOD to use them:

if (LoadLibraries())
	verifyfmod(FMOD::Memory_Initialize(0, 0, FMODMemoryAlloc, FMODMemoryRealloc, FMODMemoryFree));