mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-06 15:24:55 +08:00
Use UE4's memory management functions.
This fixes unexpected behavior on certain platforms for which UE4 specifically limits the maximum allocation size of malloc in favor of using optimized allocation schemes.
This commit is contained in:
parent
05d9372c0e
commit
f89f3fad21
@ -37,8 +37,26 @@ class FSpinePlugin : public SpinePlugin {
|
||||
|
||||
IMPLEMENT_MODULE( FSpinePlugin, SpinePlugin )
|
||||
|
||||
void FSpinePlugin::StartupModule() { }
|
||||
// These should be filled with UE4's specific allocator functions.
|
||||
extern "C" {
|
||||
void _spSetMalloc( void* ( *_malloc ) ( size_t size ) );
|
||||
void _spSetFree( void( *_free ) ( void* ptr ) );
|
||||
void _spSetRealloc( void* ( *_realloc ) ( void* ptr, size_t size ) );
|
||||
}
|
||||
|
||||
static void * SpineMalloc( size_t size ) {
|
||||
return FMemory::Malloc( size );
|
||||
}
|
||||
|
||||
static void * SpineRealloc( void* ptr, size_t size ) {
|
||||
return FMemory::Realloc( ptr, size );
|
||||
}
|
||||
|
||||
void FSpinePlugin::StartupModule() {
|
||||
_spSetMalloc( &SpineMalloc );
|
||||
_spSetRealloc( &SpineRealloc );
|
||||
_spSetFree( FMemory::Free );
|
||||
}
|
||||
|
||||
void FSpinePlugin::ShutdownModule() { }
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user