Answered
0
0

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?

Thanks.

  • You must to post comments
Best Answer
0
0

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?

  • Zac Sandine
    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?
  • Geoff Carlton
    You should be able to add that call to Memory_Initialize after LoadLibraries() in FMODStudioModule.cpp
  • Andrew Bennison

    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
    AssetTable.Create();
    …..

  • You must to post comments
1
0

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:
https://ps4.scedev.net/resources/documents/SDK/3.000/C_and_Cpp_standard_libraries/stdlib.html#malloc

  • You must to post comments
0
0

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)
{
    FMemory::Free(ptr);
}

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

if (LoadLibraries())
{
    verifyfmod(FMOD::Memory_Initialize(0, 0, FMODMemoryAlloc, FMODMemoryRealloc, FMODMemoryFree));
  • You must to post comments
Showing 3 results
Your Answer

Please first to submit.