SLikeNet 0.1.3

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Namespaces | Functions | Variables
memoryoverride.h File Reference

If _USE_RAK_MEMORY_OVERRIDE is defined, memory allocations go through rakMalloc, rakRealloc, and rakFree. More...

`#include "Export.h"`
`#include "defines.h"`
`#include <new>`
`#include "alloca.h"`

Go to the source code of this file.

## Namespaces

namespace | SLNet
| Simple class to send changes between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.

## Functions

void RAK_DLL_EXPORT | SetMalloc (void *(*userFunction)(size_t size))
void RAK_DLL_EXPORT | SetRealloc (void *(*userFunction)(void *p, size_t size))
void RAK_DLL_EXPORT | SetFree (void(*userFunction)(void *p))
void RAK_DLL_EXPORT | SetMalloc_Ex (void *(*userFunction)(size_t size, const char *file, unsigned int line))
void RAK_DLL_EXPORT | SetRealloc_Ex (void *(*userFunction)(void *p, size_t size, const char *file, unsigned int line))
void RAK_DLL_EXPORT | SetFree_Ex (void(*userFunction)(void *p, const char *file, unsigned int line))
void RAK_DLL_EXPORT | SetNotifyOutOfMemory (void(*userFunction)(const char *file, const long line))
void RAK_DLL_EXPORT | SetDLMallocMMap (void *(*userFunction)(size_t size))
void RAK_DLL_EXPORT | SetDLMallocDirectMMap (void *(*userFunction)(size_t size))
void RAK_DLL_EXPORT | SetDLMallocMUnmap (int(*userFunction)(void *ptr, size_t size))
template<class Type >
RAK_DLL_EXPORT Type * | SLNet::OP_NEW (const char *file, unsigned int line)
template<class Type , class P1 >
RAK_DLL_EXPORT Type * | SLNet::OP_NEW_1 (const char *file, unsigned int line, const P1 &p1)
template<class Type , class P1 , class P2 >
RAK_DLL_EXPORT Type * | SLNet::OP_NEW_2 (const char *file, unsigned int line, const P1 &p1, const P2 &p2)
template<class Type , class P1 , class P2 , class P3 >
RAK_DLL_EXPORT Type * | SLNet::OP_NEW_3 (const char *file, unsigned int line, const P1 &p1, const P2 &p2, const P3 &p3)
template<class Type , class P1 , class P2 , class P3 , class P4 >
RAK_DLL_EXPORT Type * | SLNet::OP_NEW_4 (const char *file, unsigned int line, const P1 &p1, const P2 &p2, const P3 &p3, const P4 &p4)
template<class Type >
RAK_DLL_EXPORT Type * | SLNet::OP_NEW_ARRAY (const int count, const char *file, unsigned int line)
template<class Type >
RAK_DLL_EXPORT void | SLNet::OP_DELETE (Type *buff, const char *file, unsigned int line)
template<class Type >
RAK_DLL_EXPORT void | SLNet::OP_DELETE_ARRAY (Type *buff, const char *file, unsigned int line)
void RAK_DLL_EXPORT * | SLNet::_RakMalloc (size_t size)
void RAK_DLL_EXPORT * | SLNet::_RakRealloc (void *p, size_t size)
void RAK_DLL_EXPORT | SLNet::_RakFree (void *p)
void RAK_DLL_EXPORT * | SLNet::_RakMalloc_Ex (size_t size, const char *file, unsigned int line)
void RAK_DLL_EXPORT * | SLNet::_RakRealloc_Ex (void *p, size_t size, const char *file, unsigned int line)
void RAK_DLL_EXPORT | SLNet::_RakFree_Ex (void *p, const char *file, unsigned int line)
void RAK_DLL_EXPORT * | SLNet::_DLMallocMMap (size_t size)
void RAK_DLL_EXPORT * | SLNet::_DLMallocDirectMMap (size_t size)
int RAK_DLL_EXPORT | SLNet::_DLMallocMUnmap (void *p, size_t size)
void | UseRaknetFixedHeap (size_t initialCapacity, void *(*yourMMapFunction)(size_t size)=SLNet::_DLMallocMMap, void *(*yourDirectMMapFunction)(size_t size)=SLNet::_DLMallocDirectMMap, int(*yourMUnmapFunction)(void *p, size_t size)=SLNet::_DLMallocMUnmap)
void | FreeRakNetFixedHeap (void)

## Variables

RAK_DLL_EXPORT void *(* | rakMalloc )(size_t size)
RAK_DLL_EXPORT void *(* | rakRealloc )(void *p, size_t size)
RAK_DLL_EXPORT void(* | rakFree )(void *p)
RAK_DLL_EXPORT void *(* | rakMalloc_Ex )(size_t size, const char *file, unsigned int line)
RAK_DLL_EXPORT void *(* | rakRealloc_Ex )(void *p, size_t size, const char *file, unsigned int line)
RAK_DLL_EXPORT void(* | rakFree_Ex )(void *p, const char *file, unsigned int line)
RAK_DLL_EXPORT void(* | notifyOutOfMemory )(const char *file, const long line)
RAK_DLL_EXPORT void *(* | dlMallocMMap )(size_t size)
RAK_DLL_EXPORT void *(* | dlMallocDirectMMap )(size_t size)
RAK_DLL_EXPORT int(* | dlMallocMUnmap )(void *ptr, size_t size)
RAK_DLL_EXPORT void *(*)(size_t size) | GetMalloc ()
RAK_DLL_EXPORT void *(*)(void *p, size_t size) | GetRealloc ()
RAK_DLL_EXPORT void(*)(void *p) | GetFree ()
RAK_DLL_EXPORT void *(*)(size_t size, const char *file, unsigned int line) | GetMalloc_Ex ()
RAK_DLL_EXPORT void *(*)(void *p, size_t size, const char *file, unsigned int line) | GetRealloc_Ex ()
RAK_DLL_EXPORT void(*)(void *p, const char *file, unsigned int line) | GetFree_Ex ()
RAK_DLL_EXPORT void *(*)(size_t size) | GetDLMallocMMap ()
RAK_DLL_EXPORT void *(*)(size_t size) | GetDLMallocDirectMMap ()
RAK_DLL_EXPORT int(*)(void *ptr, size_t size) | GetDLMallocMUnmap ()

## Detailed Description

If _USE_RAK_MEMORY_OVERRIDE is defined, memory allocations go through rakMalloc, rakRealloc, and rakFree.

Definition in file memoryoverride.h.

## Function Documentation

void FreeRakNetFixedHeap | ( | void |  | ) |

Definition at line 293 of file RakMemoryOverride.cpp.

void RAK_DLL_EXPORT SetDLMallocDirectMMap | ( | void *(*)(size_t size) | userFunction | ) |

Definition at line 102 of file RakMemoryOverride.cpp.

References dlMallocDirectMMap.

void RAK_DLL_EXPORT SetDLMallocMMap | ( | void *(*)(size_t size) | userFunction | ) |

Definition at line 98 of file RakMemoryOverride.cpp.

References dlMallocMMap.

void RAK_DLL_EXPORT SetDLMallocMUnmap | ( | int(*)(void *ptr, size_t size) | userFunction | ) |

Definition at line 106 of file RakMemoryOverride.cpp.

References dlMallocMUnmap.

void RAK_DLL_EXPORT SetFree | ( | void(*)(void *p) | userFunction | ) |

Definition at line 78 of file RakMemoryOverride.cpp.

References rakFree.

void RAK_DLL_EXPORT SetFree_Ex | ( | void(*)(void *p, const char *file, unsigned int line) | userFunction | ) |

Definition at line 90 of file RakMemoryOverride.cpp.

References rakFree_Ex.

void RAK_DLL_EXPORT SetMalloc | ( | void *(*)(size_t size) | userFunction | ) |

Definition at line 70 of file RakMemoryOverride.cpp.

References rakMalloc.

void RAK_DLL_EXPORT SetMalloc_Ex | ( | void *(*)(size_t size, const char *file, unsigned int line) | userFunction | ) |

Definition at line 82 of file RakMemoryOverride.cpp.

References rakMalloc_Ex.

void RAK_DLL_EXPORT SetNotifyOutOfMemory | ( | void(*)(const char *file, const long line) | userFunction | ) |

Definition at line 94 of file RakMemoryOverride.cpp.

References notifyOutOfMemory.

void RAK_DLL_EXPORT SetRealloc | ( | void *(*)(void *p, size_t size) | userFunction | ) |

Definition at line 74 of file RakMemoryOverride.cpp.

References rakRealloc.

void RAK_DLL_EXPORT SetRealloc_Ex | ( | void *(*)(void *p, size_t size, const char *file, unsigned int line) | userFunction | ) |

Definition at line 86 of file RakMemoryOverride.cpp.

References rakRealloc_Ex.

void UseRaknetFixedHeap | ( | size_t | initialCapacity,
|  | void *(*)(size_t size) | yourMMapFunction = `SLNet::_DLMallocMMap`,
|  | void *(*)(size_t size) | yourDirectMMapFunction = `SLNet::_DLMallocDirectMMap`,
|  | int(*)(void *p, size_t size) | yourMUnmapFunction = `SLNet::_DLMallocMUnmap`
| ) |  |

Definition at line 283 of file RakMemoryOverride.cpp.

## Variable Documentation

RAK_DLL_EXPORT void*(* dlMallocDirectMMap)(size_t size)

Definition at line 67 of file RakMemoryOverride.cpp.

Referenced by SetDLMallocDirectMMap().

RAK_DLL_EXPORT void*(* dlMallocMMap)(size_t size)

Definition at line 66 of file RakMemoryOverride.cpp.

Referenced by SetDLMallocMMap().

RAK_DLL_EXPORT int(* dlMallocMUnmap)(void *ptr, size_t size)

Definition at line 68 of file RakMemoryOverride.cpp.

Referenced by SetDLMallocMUnmap().

RAK_DLL_EXPORT void*(*)(size_t size) GetDLMallocDirectMMap()

Definition at line 138 of file RakMemoryOverride.cpp.

RAK_DLL_EXPORT void*(*)(size_t size) GetDLMallocMMap()

Definition at line 134 of file RakMemoryOverride.cpp.

RAK_DLL_EXPORT int(*)(void* ptr, size_t size) GetDLMallocMUnmap()

Definition at line 142 of file RakMemoryOverride.cpp.

RAK_DLL_EXPORT void(*)(void *p) GetFree()

Definition at line 118 of file RakMemoryOverride.cpp.

RAK_DLL_EXPORT void(*)(void *p, const char *file, unsigned int line) GetFree_Ex()

Definition at line 130 of file RakMemoryOverride.cpp.

Referenced by SLNet::OP_DELETE(), and SLNet::OP_DELETE_ARRAY().

RAK_DLL_EXPORT void*(*)(size_t size) GetMalloc()

Definition at line 110 of file RakMemoryOverride.cpp.

RAK_DLL_EXPORT void*(*)(size_t size, const char *file, unsigned int line) GetMalloc_Ex()

Definition at line 122 of file RakMemoryOverride.cpp.

Referenced by SLNet::OP_NEW(), SLNet::OP_NEW_1(), SLNet::OP_NEW_2(), SLNet::OP_NEW_3(), SLNet::OP_NEW_4(), and SLNet::OP_NEW_ARRAY().

RAK_DLL_EXPORT void*(*)(void *p, size_t size) GetRealloc()

Definition at line 114 of file RakMemoryOverride.cpp.

RAK_DLL_EXPORT void*(*)(void *p, size_t size, const char *file, unsigned int line) GetRealloc_Ex()

Definition at line 126 of file RakMemoryOverride.cpp.

RAK_DLL_EXPORT void(* notifyOutOfMemory)(const char *file, const long line)

Definition at line 65 of file RakMemoryOverride.cpp.

Referenced by SLNet::RakString::Assign(), SLNet::RakWString::operator+=(), SLNet::RakWString::operator=(), SLNet::ReliabilityLayer::Send(), SLNet::RakPeer::SendBuffered(), SLNet::RakPeer::SendBufferedList(), SLNet::PluginInterface2::SendListUnified(), and SetNotifyOutOfMemory().

RAK_DLL_EXPORT void(* rakFree)(void *p)

Definition at line 61 of file RakMemoryOverride.cpp.

Referenced by SetFree().

RAK_DLL_EXPORT void(* rakFree_Ex)(void *p, const char *file, unsigned int line)

Definition at line 64 of file RakMemoryOverride.cpp.

Referenced by SLNet::RakString::Assign(), DataStructures::Table::Cell::Cell(), DataStructures::ByteQueue::Clear(), DataStructures::MemoryPool< MemoryBlockType >::Clear(), DataStructures::Table::Cell::Clear(), SLNet::RakWString::Clear(), SLNet::CloudServer::CloudData::Clear(), SLNet::RakPeer::ClearBanList(), SLNet::RakPeer::ClearBufferedCommands(), SLNet::RakPeer::DeallocatePacket(), SLNet::PluginInterface2::DeallocPacketUnified(), SLNet::StringCompressor::DecodeString(), SLNet::RakWString::Deserialize(), SLNet::RakString::Free(), VariadicSQLParser::FreeArguments(), SLNet::HuffmanEncodingTree::FreeMemory(), SLNet::RakString::FreeMemoryNoMutex(), DataStructures::MemoryPool< MemoryBlockType >::InitPage(), SLNet::RakPeer::IsBanned(), DataStructures::Table::Cell::operator=(), SLNet::BitStream::ReadAlignedBytesSafeAlloc(), DataStructures::BytePool::Release(), DataStructures::MemoryPool< MemoryBlockType >::Release(), SLNet::RakPeer::RemoveFromBanList(), SLNet::RakPeer::RunUpdateCycle(), SLNet::RakPeer::SendBufferedList(), SLNet::RakPeer::SendImmediate(), SLNet::PluginInterface2::SendListUnified(), SLNet::RakWString::Serialize(), SetFree_Ex(), SLNet::BitStream::~BitStream(), SLNet::CloudServer::CloudData::~CloudData(), SLNet::RakWString::~RakWString(), SLNet::StringTable::~StringTable(), and SLNet::VariableListDeltaTracker::~VariableListDeltaTracker().

RAK_DLL_EXPORT void*(* rakMalloc)(size_t size)

Definition at line 59 of file RakMemoryOverride.cpp.

Referenced by SetMalloc().

RAK_DLL_EXPORT void*(* rakMalloc_Ex)(size_t size, const char *file, unsigned int line)

Definition at line 62 of file RakMemoryOverride.cpp.

Referenced by SLNet::BitStream::AddBitsAndReallocate(), SLNet::StringTable::AddString(), SLNet::RakPeer::AddToBanList(), DataStructures::BytePool::Allocate(), DataStructures::MemoryPool< MemoryBlockType >::Allocate(), SLNet::RakString::Allocate(), SLNet::PluginInterface2::AllocatePacketUnified(), SLNet::RakPeer::AllocPacket(), SLNet::BitStream::AssertCopyData(), Base64Encoding(), SLNet::BitStream::BitStream(), DataStructures::Table::Cell::Cell(), SLNet::BitStream::CopyData(), SLNet::StringCompressor::DecodeString(), SLNet::DataCompressor::DecompressAndAllocate(), SLNet::RakWString::Deserialize(), VariadicSQLParser::ExtractArguments(), DataStructures::MemoryPool< MemoryBlockType >::InitPage(), operator+(), SLNet::RakWString::operator+=(), SLNet::RakWString::operator=(), DataStructures::Table::Cell::operator=(), SLNet::BitStream::ReadAlignedBytesSafeAlloc(), SLNet::RakString::Realloc(), SLNet::RakPeer::SendBuffered(), SLNet::RakPeer::SendBufferedList(), SLNet::RakPeer::SendImmediate(), SLNet::PluginInterface2::SendListUnified(), SLNet::RakWString::Serialize(), DataStructures::Table::Cell::Set(), SetMalloc_Ex(), and SLNet::VariableListDeltaTracker::VariableLastValueNode::VariableLastValueNode().

RAK_DLL_EXPORT void*(* rakRealloc)(void *p, size_t size)

Definition at line 60 of file RakMemoryOverride.cpp.

Referenced by SetRealloc().

RAK_DLL_EXPORT void*(* rakRealloc_Ex)(void *p, size_t size, const char *file, unsigned int line)

Definition at line 63 of file RakMemoryOverride.cpp.

Referenced by SLNet::BitStream::AddBitsAndReallocate(), SLNet::RakString::Assign(), SLNet::RakWString::operator+=(), SLNet::RakString::Realloc(), SetRealloc_Ex(), DataStructures::ByteQueue::WriteBytes(), and SLNet::VariableListDeltaTracker::WriteVar().