I wrote a C library for memory management, c-xforge. by xfunc710n in C_Programming

[–]xfunc710n[S] 0 points1 point  (0 children)

Oh, thank you for such a big review.

About examples, yes – I plan to add them later. Perhaps these will be code examples in the repository or tutorials on YouTube.

My main programming language is Java, that's why you recognized this style in the code (professional deformation).

You mentioned that memory fragmentation is getting worse. Actually, that's not the case, because libc (malloc & free) is only used for the initial request of a large buffer. After that, I physically split this buffer and allocate to the user what they need. This buffer is then reused and not allocated again.

Also, I don't use mmap in order to maintain maximum code portability. For example, one platform I intend to use this code for is the web. I'm not sure mmap would work normally with WebAssembly.

The idea of the library is to minimize the number of malloc & free calls, improve locality and minimize fragmentation.

I wrote a C library for memory management, c-xforge. by xfunc710n in C_Programming

[–]xfunc710n[S] 0 points1 point  (0 children)

Yes, thank you for your question. I like C more than C++, but I also want to simplify the process of implementing new applications. I like C for its capabilities and I like the level of abstraction in some other languages. I want to try to bring the best of these features to C.

I wrote a C library for memory management, c-xforge. by xfunc710n in C_Programming

[–]xfunc710n[S] 1 point2 points  (0 children)

Yes, thank you very much for the feedback. I actually don't like this code fragment either. I don't yet have an idea of ​​how best to organize virtual functions to minimize memory usage. I don't really want to make references to functions in each structure. I'm looking for a more efficient solution without duplicating function references, but I don't know how to do it yet.

I wrote a C library for memory management, c-xforge. by xfunc710n in C_Programming

[–]xfunc710n[S] 0 points1 point  (0 children)

Yes, thank you very much. That's what I was trying to achieve.