Download

UObject::CallFunction mem leak or am I just misunderstanding

While tracing some calls through UObject::CallFunction, I noticed this:


    if (Function->FunctionFlags & FUNC_Native)
    {
        uint8* Buffer = (uint8*)FMemory_Alloca(Function->ParmsSize);
        int32 FunctionCallspace = GetFunctionCallspace( Function, Buffer, &Stack );

The ‘Buffer’ variable goes on to get used some if doing RPC, but if you’re just making a local call, then nothing ever seems to touch it. And inside GetFunctionCallspace, it never gets used if the object in question is an AActor.

So it makes me wonder, where does this memory get freed? I haven’t traced it through with RPC calls, but for local calls, I can’t find any place that frees that buffer, much less touches it again. Does anyone know where (or if) this memory gets freed?

It’s within scope of a function so it is deleted as soon the function exits.

Oh, haha - it’s a wrapper around alloc not malloc. Thank you!