By this somewhat generic term, we group all the plumbing tools used by an application doing graphics with REDsdk and that can be freely customized:

Memory allocation tools

REDsdk's uses the default system memory allocator. However, this allocator can be freely changed, by accessing the RED::MemoryAllocator instance of the application.


Task: Accessing and customizing the memory allocator

Let's start by defining a custom function for allocations performed using the 'new' operator:

void* myCustomNew( size_t size )
  // Here, set your own memory management code!
  return NULL;

Then, we can access the RED::MemoryAllocator and replace the current function by our new function:

// The memory allocator is a singleton:
RED::MemoryAllocator& mal = RED::MemoryAllocator::Get();

// Let's override the 'new' method:
mal.SetCustomNew( myCustomNew );

For simplicity, we do only replace one single memory function in the example above. To fully customize the memory management in REDsdk, all functions defined in the RED::MemoryAllocator class should be replaced by the application.

Memory allocation tracking tools

REDsdk can keep track of all allocations it makes. If memory allocation tracking is enabled, then all allocations and de-allocations made by the engine are recorded as a whole. While this can have a significative impact on performances, this allow the application to easily detect memory leaks or to look for memory management errors.

The RED::MemoryLeakTracker is accessed using RED::MemoryAllocator::GetMemoryLeakTracker. Memory allocation tracking is enabled directly on the memory allocator using RED::MemoryAllocator::SetMemoryTracking.

File system tools

Similarly to the memory tools, REDsdk's file system can be customized. The RED::FileSystemTools static interface provides all the necessary methods to customize REDsdk's file management methods.

REDsdk STL tools

The full REDsdk API uses a custom implementation of the well known std::vector and std::map classes. These are the RED::Vector and RED::Map classes. REDsdk uses its own classes to avoid external dependencies with the STL on some platforms and also to ease debugging. The REDsdk vectors and map can be easily parsed directly from a debugger.

Multi-threading tools

The RED::Thread class can be used to launch calculation threads to leverage the calculating power of multiple CPU cores. REDsdk threads run on Windows, Linux and MacOS systems.

Timing tools

The RED::Timer is a very small class that can be used quite easily to get accurate timings. It uses operating system proprietary calls to provide an accurate estimation of the elapsed time between two measurement ticks.