If, for example, I have the below snippet
int *pInt = new int[5];
Is there a way of testing whether the memory at or above pInt[5] is free, or in use?
Not really. More importantly, why do you think you need to know?
If new throws an exception, it couldn't give you the memory you asked for. If it doesn't, the memory was free and has now been allocated for your use.
Last edited on