Arindam Bhattacharjee wrote:
> Hello,
> Although it is a Linux UG and not a C UG, yet can someone please solve my
> one problem. In my program (written in C under Linux OS) whenever, wherever
> free() call appears, it creates a run time error.The same progam is very fine
> without the free() calls. Is there anything to do with the compiler flags?
> Can someone please help.
Arindam, more information is needed if you want help on this. Most
common cause of errorsin free() calls happen if you try to free up
memory that does not belong to you. Check if your memory allocations
match the memory deallocations, and whether your malloc()s are happening
successfully.
One of the best ways to debug memory problems is to us ElectricFence.
See if you have it installed. The package should have a file called
libefence.a . Compile your programs with exactly the same options that
you are using but add the extra parameter "-lefence" at the end of the
gcc command line. Run the compiled program now, and you would have a
more verbose memory allocation checks and better explanation when your
program fails.
After you fix the problem, stop adding the argument to gcc for
production compiles.
- Sandip
================================================
To subscribe, send email to [EMAIL PROTECTED] with subscribe in subject header
To unsubscribe, send email to [EMAIL PROTECTED] with unsubscribe in subject header
Archives are available at http://www.mail-archive.com/ilugd%40wpaa.org
=================================================