Hi,
I written a rather large program in C that runs on Web Servers, with probably about 50 different functions, some very long others short. For a long time all I used were arrays for opening files, storing data etc. Since some files lately were getting too large for normal arrays I used malloc() dynamic memory allocation.
I've come across a strange segmentation fault on only 1 server so far - not any other servers yet. I have used malloc to define a number of memory pointers in the main function and then the main function calls a smaller sub function. This sub function has its own malloc calls and at the end of this sub function free(pointer); is used to free up the memory. Now for some reason upon return to the main function again the segmentation fault happens. For the life of me I can't figure out why, and it works fine on other servers, its just this one server so far that keeps giving segmentation faults at this point.
I tried renaming the malloc pointers, shuffling things around etc, it always fails on the "return" -> end of the sub function.
Is there some memory issue you need to know about using malloc? This server in question has 2GB ram, plenty, my functions on use up about 1 or 2 MBs.
Anyone got any ideas? Thoughts? Little tricks of the trade?
Many thanks to anyone who responds