Skip to main content

Troubleshooting

Android and iOS Crashes

In some cases on Android and iOS, crashes may occur during runtime (such as during TestFlight testing). This is caused by the underlying llama.cpp library's memory allocation requirements conflicting with Unreal Engine's default allocators on these platforms. On other platforms, FMalloc defaults to the ANSI allocator, so this issue is specific to Android and iOS.

To resolve this, you need to force the ANSI allocator in your project's Target.cs file:

For Unreal Engine 5.5 and earlier:

  • Your project must use a source-built engine (not a pre-compiled binary)
  • Add the following line to your Target.cs file:
GlobalDefinitions.Add("FORCE_ANSI_ALLOCATOR=1");

For Unreal Engine 5.6 and later:

  • Works with both source-built and pre-compiled engine builds
  • Add the following two lines to your Target.cs file:
bOverrideBuildEnvironment = true;
StaticAllocator = StaticAllocatorType.Ansi;

This forces Unreal Engine to use the ANSI allocator on Android and iOS, matching the allocator used by llama.cpp.