NewToCPP wrote:
Is there any way I can check the size of the Memory allocated by "new"?
Generally speaking, you asked it to allocate a particular object, right?
That object has a size. You can query it by saying 'sizeof(*ptr)', where
'ptr' is the pointer you got from the 'new'. If you used 'new[]', then
you need to multiply it by the value of the expression in the brackets.
Of course, due to some variations in memory management implementations,
"true" allocation will be different from the "theoretical" one. In order
to learn the "true" allocation, you need to use either the implementation-
specific or the platform-specific means, whichever is available. There is
no way in the Standard C++ to find out how much "true" memory was used to
accommodate the objects created by 'new' or 'new[]'.
V