I have declared a global variable which is array of pointers and
allocated memory for each array variable by using malloc. Some thing
similar to below...
static char *arr[10];
main()
{
int i;
for(i = 0; i < 10; i++)
arr[i] = malloc(sizeof(c har));
……..
}
Is freeing the allocated memory is really required every time, for a
program like this as freeing doesn’t bring in any change w.r.t
memory space (or) will it become a memleak some where down the line if
it is not freeed?
Thanx,
Ravindra. Bhadramraju
allocated memory for each array variable by using malloc. Some thing
similar to below...
static char *arr[10];
main()
{
int i;
for(i = 0; i < 10; i++)
arr[i] = malloc(sizeof(c har));
……..
}
Is freeing the allocated memory is really required every time, for a
program like this as freeing doesn’t bring in any change w.r.t
memory space (or) will it become a memleak some where down the line if
it is not freeed?
Thanx,
Ravindra. Bhadramraju
Comment