Skip to content
Sign upLog in
← Back to Community

Memory Buffer

Profile icon

I seriously have way too many ideas for projects..good lord Jesus above help me..

So, in this project, it basically just stores a whole bunch of pointers in an array as well as there allocation size. The application would then allocate strict memory block sizes(using malloc) to each pointer.

After this, when each pointer is used, some memory from the memory allocations struct(which will hold sizes of each memory allocation within an array) will then witness a few bitwise operations to check memory allocations and check if it is leaking any memory(I think I am just going to check recent usage of the pointer, meaning how much memory was used, then compare it to the last strict allocation of that pointer).

Yeah..I don't know. It is gonna be kinda like my own version of memory allocations, but at the same time I am not making my own version of memory allocations, I am "buffering" the memory to prevent memory leaks.

FYI..(to all my C programmers)..use: valgrind ./main.o, or ./main if you don't compile with gcc, if you want to check memory leaks..AND..I highly recommend you to use Makefiles with EVERY C project you make as well as using the gcc compiler!

Thank me later for the valgrind tip :)

I am doing this for the Brew Programming language and my Porting Application so I can "buffer" memory without having to free useful memory

Test out the valgrind method on my project by running my project then typing valgrind ./main in the terminal!

Thoughts? Comment and upvote thanks!!

Profile icon
Profile icon
Profile icon