Rishka
RISC-V virtual runtime in C/C++ made for ESP32-WROVER
Memory Class Referencefinal

Class for handling memory management operations in Rishka applications. More...

#include <memory.h>

Static Public Member Functions

static void initialize ()
 
static any alloc (usize size)
 Allocate memory. More...
 
static any calloc (usize num, usize size)
 Allocate and clear memory. More...
 
static any realloc (any ptr, usize size)
 Reallocate memory. More...
 
static void free (any ptr)
 Free memory. More...
 
static any set (any dest, u8 c, usize n)
 Set memory values. More...
 

Detailed Description

Class for handling memory management operations in Rishka applications.

The Memory class provides static methods for allocating, reallocating, and freeing memory, as well as functions for setting memory values on ESP32-WROVER microcontrollers.

Member Function Documentation

◆ alloc()

any Memory::alloc ( usize  size)
static

Allocate memory.

This method allocates a block of memory of the specified size.

Parameters
sizeThe size of the memory block to allocate in bytes.
Returns
Pointer to the memory block of the allocated memory.

◆ calloc()

any Memory::calloc ( usize  num,
usize  size 
)
static

Allocate and clear memory.

This method allocates a block of memory of the specified size and initializes it to zero.

Parameters
destPointer to the destination memory block.
numThe number of elements in the memory block.
sizeThe size of each element in bytes.

◆ free()

void Memory::free ( any  ptr)
static

Free memory.

This method frees the memory block previously allocated by alloc, calloc, or realloc.

Parameters
ptrPointer to the memory block to free.

◆ realloc()

any Memory::realloc ( any  ptr,
usize  size 
)
static

Reallocate memory.

This method reallocates a block of memory to the specified size.

Parameters
destPointer to the destination memory block.
ptrPointer to the previously allocated memory block.
sizeThe new size of the memory block in bytes.

◆ set()

static any Memory::set ( any  dest,
u8  c,
usize  n 
)
static

Set memory values.

This method sets the first n bytes of the memory block pointed to by dest to the specified value.

Parameters
destPointer to the destination memory block.
cThe value to set.
nThe number of bytes to set.
Returns
Pointer to the memory block.

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