Re: trouble in freeing memory using realloc
- From: Eric Sosman <eric.sosman@xxxxxxx>
- Date: Wed, 08 Jun 2005 14:40:43 -0400
cijo wrote:
> Hi,
>
> My program has a pointer to a structure declared locally inside a
> function to which memory is allocated using malloc and reallocated
> later using realloc, and when I try to free the memory at the end of
> the function, the program breaks down. While debugging, I find that the
> address to which the pointer is pointing is changed during one of the
> realloc calls. But as per the documentation on realloc, the change of
> address is perfectly normal. Some of my colleagues say the failure in
> 'free'ing the memory is due to some bug in 'realloc'. I find it hard to
> believe though. Is it dependent on the compiler (the IDE is MS Visual
> Studion .NET 2003) or could there be something wrong with my code?
There could be something wrong with your code.
Try distilling the problem down to a short but complete
and compilable example that shows the trouble, and post
that example. It is astonishing how much better my crystal
ball works when I don't need to consult it ...
--
Eric.Sosman@xxxxxxx
.
- Follow-Ups:
- Re: trouble in freeing memory using realloc
- From: cijo
- Re: trouble in freeing memory using realloc
- References:
- trouble in freeing memory using realloc
- From: cijo
- trouble in freeing memory using realloc
- Prev by Date: Re: C program to automatically press F6 every few seconds
- Next by Date: Re: trouble in freeing memory using realloc
- Previous by thread: trouble in freeing memory using realloc
- Next by thread: Re: trouble in freeing memory using realloc
- Index(es):
Relevant Pages
|