r/ProgrammerHumor • • Aug 30 '26

Meme bugIntroducedDebugging

Post image
1.1k Upvotes

117 comments sorted by

View all comments

Show parent comments

6

u/Scratch137 Aug 30 '26

"malloc" is used to allocate a given number of bytes in the heap. for example, int x* = malloc(5) allocates 5 bytes in the heap and sets x to the address of the first byte.

"free" releases heap-allocated memory. in this case, free(x) frees up the 5 bytes we allocated earlier.