@@ -66,6 +66,11 @@ typedef struct
66
66
uint64_t oom_count;
67
67
} O1HeapDiagnostics;
68
68
69
+ // / o1heapInit() will fail unless the arena size is at least this large.
70
+ // / This value depends only on the machine architecture.
71
+ // / The other reason to fail is if the arena pointer is not aligned at O1HEAP_ALIGNMENT.
72
+ extern const size_t o1heapMinArenaSize;
73
+
69
74
// / The arena base pointer shall be aligned at O1HEAP_ALIGNMENT, otherwise NULL is returned.
70
75
// /
71
76
// / The total heap capacity cannot exceed approx. (SIZE_MAX/2). If the arena size allows for a larger heap,
@@ -76,10 +81,13 @@ typedef struct
76
81
// / own needs (normally about 40..600 bytes depending on the architecture, but this parameter is not characterized).
77
82
// / A pointer to the newly initialized instance is returned.
78
83
// /
79
- // / If the provided space is insufficient, NULL is returned.
84
+ // / The function fails and returns NULL iff:
85
+ // / - The provided space is less than o1heapMinArenaSize.
86
+ // / - The base pointer is not aligned at O1HEAP_ALIGNMENT.
87
+ // / - The base pointer is NULL.
80
88
// /
81
- // / An initialized instance does not hold any resources. Therefore, if the instance is no longer needed,
82
- // / it can be discarded without any de-initialization procedures.
89
+ // / An initialized instance does not hold any resources except for the arena memory.
90
+ // / Therefore, if the instance is no longer needed, it can be discarded without any de-initialization procedures.
83
91
// /
84
92
// / The heap is not thread-safe; external synchronization may be required.
85
93
O1HeapInstance* o1heapInit (void * const base, const size_t size);
0 commit comments