Rishka
RISC-V virtual runtime in C/C++ made for ESP32-WROVER
memory.h
Go to the documentation of this file.
1/*
2 * This file is part of the Rishka distribution (https://github.com/nthnn/rishka).
3 * Copyright (c) 2024 Nathanne Isip.
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, version 3.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
27#ifndef LIBRISHKA_MEM_H
28#define LIBRISHKA_MEM_H
29
30#include <librishka/types.h>
31
39class Memory final {
40public:
41 static void initialize();
42
51 static any alloc(usize size);
52
63 static any calloc(usize num, usize size);
64
74 static any realloc(any ptr, usize size);
75
83 static void free(any ptr);
84
95 static any set(any dest, u8 c, usize n);
96};
97
98#endif /* LIBRISHKA_MEM_H */
Class for handling memory management operations in Rishka applications.
Definition: memory.h:39
static any realloc(any ptr, usize size)
Reallocate memory.
Definition: librishka_mem.cpp:110
static any alloc(usize size)
Allocate memory.
Definition: librishka_mem.cpp:69
static any calloc(usize num, usize size)
Allocate and clear memory.
Definition: librishka_mem.cpp:101
static any set(any dest, u8 c, usize n)
Set memory values.
static void free(any ptr)
Free memory.
Definition: librishka_mem.cpp:91
Header file for common data types used in Rishka applications.
unsigned char u8
Alias for the unsigned 8-bit integer type.
Definition: types.h:70
void * any
Alias for the generic pointer type.
Definition: types.h:100
u32 usize
Alias for the unsigned integer type representing size.
Definition: types.h:94