https://github.com/antoninhrlt/memlib
Memory allocations and management library written in C to be used without the standard library
https://github.com/antoninhrlt/memlib
c c-language memory-allocation memory-management no-std
Last synced: 17 days ago
JSON representation
Memory allocations and management library written in C to be used without the standard library
- Host: GitHub
- URL: https://github.com/antoninhrlt/memlib
- Owner: antoninhrlt
- License: mit
- Created: 2022-05-20T21:19:30.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2022-05-21T10:56:26.000Z (about 4 years ago)
- Last Synced: 2025-05-31T06:54:28.852Z (about 1 year ago)
- Topics: c, c-language, memory-allocation, memory-management, no-std
- Language: C
- Homepage: https://blog.antoninhrlt.com/how-to-rewrite-malloc-from-scratch-with-c
- Size: 11.7 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# memlib
Memory allocations and management library written in C to be used without the standard library
## Get started
The project is using [xmake](https://xmake.io) and it requires to have this tool
installed on your computer.
- `git clone https://github.com/antoninhrlt/memlib`
- `cd memlib`
- `xmake install` (or `xmake install -o `)
The library is now installed on your computer and you can start using it !
## Example
```c
int array[] = {1, 2, 3};
int* copy = memlib_alloc(sizeof(int) * 3);
memlib_copy(copy, array, 3);
printf("%p : [%i, %i, %i]\n", copy, copy[0], copy[1], copy[2]);
// Indicate if both arrays are the same
printf("? %s\n", memlib_comp(array, copy, 3) ? "true" : "false");
memlib_free(copy);
```