![]() |
Override new, delete, malloc, free, and realloc
Users wishing to provide custom memory management functions can do so via RakMemoryOverride.cpp. There are 3 global pointers defined in this file, with predefined defaults: void* (*rakMalloc) (size_t size) = RakMalloc; To override, simply set the values of these variables to something else. For example, to override malloc, you may write: #include "RakMemoryOverride.h" void *MyMalloc(size_t size) int main() Then go to RakNetDefines.h and uncomment // #define _USE_RAK_MEMORY_OVERRIDE Note: RakNet is already memory efficient and uses pools and other techniques for memory management. If RakNet memory usage is a problem, reduce the number of allowed connections, or comment out NETWORK_ID_USE_PTR_TABLE in NetworkIDManager.h |
![]() |