blob: 4bee68d5f7e1924a76e6d448d0319b5c17c4d684 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
1. Introduction
Code libraries built for my personal use. Use with caution... and care.
------------------------------
2. Table of Contents
a. Memory
- Arena Allocator
- Stack Allocator
b. String (Under Construction)
------------------------------
a. Memory
A simplistic but highly functional helper functions in C. These utilize the concept of allocators to enforce programming
on a clear and simple concept model. For more info on why and how these work, please search online on some data-oriented
videos.
They are used in a known programming environment, where every allocation is known and is meant to be tracked. Due to
this, while it is possible to cause weird overwrite problems, something that I was quite concerned with for a while,
the reason those won't be a concern is because everything about allocation, and about total allocation capacity is known.
Q. In what cases would this break?
In specific cases the memory allocators that detect capacity of the buffer can fail to detect if the programmer tries
allocating memory that is larger than int32 in value, but smaller than the available capacity. In this case, since the
amount of memory in int32 will wrap around, it would be indiscernable to the allocation checks if the allocation was
valid or invalid. This would pass the check but eventually fail when allocating and crash the program.
Q. Why is this not a concern?
This will be used in a known programming environment. Every allocation is meant to be known and tracked. While the
larger than available memory issue will still be possible, the burden of responsibility is on the programmer (me) to
understand that I am not meant to allocate space greater than the size_t (target platform).
|