Suppose I have allocated memory to some pointer in a function foo
:
void foo()
{
// ...
int *ptr = malloc(20*sizeof(int));
bar (ptr);
}
From foo()
, I pass this pointer to bar()
and let's say from bar()
to another function.
Now, at some point of time, I want to check: How much memory was allocated to the pointer.
Is there any possible way, without searching for the statement:
int *ptr = malloc(20*sizeof(int));
to figure out how much memory is allocated to the pointer, using GDB?
Thanks.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…