Is there a way in C to find out the size of dynamically allocated memory?
For example, after
char* p = malloc (100);
Is there
comp.lang.c FAQ list · Question 7.27 -
Q. So can I query the malloc
package to find out how big an allocated block is?
A. Unfortunately, there is no standard or portable way. (Some compilers provide nonstandard extensions.) If you need to know, you'll have to keep track of it yourself. (See also question 7.28.)