Problem with BuildData file size

Hello guys! I’m getting the Error: FMemoryWriter does not support data larger than 2GB.

The problem is with the BuildData file that contain the lightmaps but unfortunately I cannot reduce the lightmaps because I’m looking for the best image quality possible.

So, is there anyway to increase this 2GB limit size? Why does this limit exist?

Thanks and best regards!

Hey daniel, I faced this problem before, the FMemoryWriter class has some limitations, but one thing you can do is split your meshes in differents levels, and then load all of them as stream levels.

but if someone knows how to increase that, that should be awesome


Hi you can remove the limits if you have Unreal Engine 4 source code. You have Look for CookOnTheFlyServer.cpp file

Go to line TArray<bool> SucceededSavePackage;

and add

if (Package->GetFileSize() >= MAX_int32)
// Disable async save with large (>2GB) package since async save uses FMemoryWriter which does not support data larger than 2GB
bShouldSaveAsync = false;

@Fieol I tried this but it doesn’t work. I am having the same error again. I have attached the screenshot of the code. Please see if I have copied it in the right place or if I’m making a mistake.

Thanks !!

I believe this limit is enforced in other places as well. This is because not all platforms UE4 targets guarantee a filesystem that support individual files larger than 2GB. The only way in your case is to split your scene into sub-levels as @ZkarmaKun suggested, so each sub-level will get their own separate BuildData file.

That could be possibly true. I tried that in 4.14 version and it worked fine. But yeah if that check is enforced anywhere else as well, then you need to find it and remove those checks too. @Manoel.Neto could you share what all place this check possibly be ?

I don’t have that info, unfortunately. But I assume removing that limit could take way more work than commenting out some checks, because the 2GB == 2,147,483,648 bytes, which is the largest value you can store in an int32. This means that if any variables dealing with file sizes or byte offsets into the files are int32, they would need to be changed to int64 too.

>=max_int32 ,so…print ‘fmemory …2GB’