The heap grows dynamically as you allocate memory. Every time you do a malloc(), if it is not using memory you have previously released using free(), your program is using memory at the end of your heap. When your program runs out of memory at the end of your heap, the heap grows.
At any rate, even manually increasing the heap size will not cause your bug to be fixed. Don't try to just make the error messages go away. Find the root cause of the problem.
If valgrind and electric fence make your program run much slower, then I can't think of any other solution than debugging the old-fashioned way: make a test copy of the source, and find out how much of the source you can pull out without making the problem go away.
Then play with that minimal broken program. Pull individual pieces out of it and learn how that makes the program's behavior change.
This will not be easy. The yellow brick road ahead of you is a long, hard yellow brick road.
Hope this helps.
|