Arcane  v3.16.2.0
Documentation développeur
Tout Classes Espaces de nommage Fichiers Fonctions Variables Définitions de type Énumérations Valeurs énumérées Amis Macros Groupes Pages Concepts
Référence de la classe Allocator

Concept for allocating, resizing and freeing memory block. Plus de détails...

#include <arcane/utils/internal/json/rapidjson/allocators.h>

+ Graphe de collaboration de Allocator:

Description détaillée

Concept for allocating, resizing and freeing memory block.

Note that Malloc() and Realloc() are non-static but Free() is static.

So if an allocator need to support Free(), it needs to put its pointer in the header of memory block.

1concept Allocator {
2 static const bool kNeedFree;
3
4 // Allocate a memory block.
5 // \param size of the memory block in bytes.
6 // \returns pointer to the memory block.
7 void* Malloc(size_t size);
8
9 // Resize a memory block.
10 // \param originalPtr The pointer to current memory block. Null pointer is permitted.
11 // \param originalSize The current size in bytes. (Design issue: since some allocator may not book-keep this, explicitly pass to it can save memory.)
12 // \param newSize the new size in bytes.
13 void* Realloc(void* originalPtr, size_t originalSize, size_t newSize);
14
15 // Free a memory block.
16 // \param pointer to the memory block. Null pointer is permitted.
17 static void Free(void *ptr);
18};
Concept for allocating, resizing and freeing memory block.

La documentation de cette classe a été générée à partir du fichier suivant :