3 ms·
It is not entirely missing that idea, since what you malloc() must be aware of its own size, even if that’s not usually something you get access to as a program
by goatinaboat 7y ago
It is not entirely missing that idea, since what you malloc() must be aware of its own size, even if that’s not usually something you get access to as a programmer.
One way I’ve seen this done is you malloc() 30 bytes, it allocates 34 and gives you a pointer to 4, and bytes 0-3 hold internal information for the malloc/free implementation.