Programs related to my uni classes are automatically tested by uni's custom system and have to meet certain requirements, one being not allocating more than you need. I've been trying to find a way to see how much memory is allocated at given points but can't figure it out (I'm using CLion). This would rapidly increase the rate of solving these problems and decrease amount of frustration I get when trying to find where am I allocating that one byte too much.
Edit: Imagine I have to allocate an array of x pointers (x being i.e. amount of lines in a file), each of them having different amounts of ints. At some point in the code my calculations are wrong and there is too much memory being allocated which is then never used. Is it possible to "lookup" the memory at a given breakpoint?