Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
roc::core::MemoryOps Class Reference

Memory operations. More...

#include <memory_ops.h>

Public Types

enum  { Pattern_BeforeUse = 0x7a , Pattern_AfterUse = 0x7d , Pattern_Canary = 0x7b }
 Some good filler patterns for memory. If we fill memory with these values and interpret it as 16-bit or 32-bit integers, or as floats, the values will be rather high and will sound loudly when trying to play them on sound card. We use a few different patterns to make it easy to distinguish between them in debugger. More...
 

Static Public Member Functions

static void poison_before_use (void *data, size_t size)
 Poison memory that is going to be used. Helps catching uninitialized access bugs. More...
 
static void poison_after_use (void *data, size_t size)
 Poison memory that is no more used. Helps catching use after free bugs. More...
 
static void prepare_canary (void *data, size_t size)
 Prepare canary memory. Helps catching buffer overflow/underflow bugs. More...
 
static bool check_canary (void *data, size_t size)
 Check canary memory. More...
 

Detailed Description

Memory operations.

Definition at line 21 of file memory_ops.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

Some good filler patterns for memory. If we fill memory with these values and interpret it as 16-bit or 32-bit integers, or as floats, the values will be rather high and will sound loudly when trying to play them on sound card. We use a few different patterns to make it easy to distinguish between them in debugger.

Definition at line 45 of file memory_ops.h.

Member Function Documentation

◆ check_canary()

static bool roc::core::MemoryOps::check_canary ( void *  data,
size_t  size 
)
static

Check canary memory.

Returns
true if passed.

◆ poison_after_use()

static void roc::core::MemoryOps::poison_after_use ( void *  data,
size_t  size 
)
static

Poison memory that is no more used. Helps catching use after free bugs.

◆ poison_before_use()

static void roc::core::MemoryOps::poison_before_use ( void *  data,
size_t  size 
)
static

Poison memory that is going to be used. Helps catching uninitialized access bugs.

◆ prepare_canary()

static void roc::core::MemoryOps::prepare_canary ( void *  data,
size_t  size 
)
static

Prepare canary memory. Helps catching buffer overflow/underflow bugs.


The documentation for this class was generated from the following file: