Visit Jeremy's Blog.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 08-01-2007, 12:24 AM   #1
LQ Newbie
Registered: Jan 2007
Posts: 20

Rep: Reputation: 0
How to increase Heap Size?

Hi Folks!

I'm facing lot of segmentation faults in my code. I tried using some memory debugger like valgrind but all in vain as they may my application a lot slower and due to which my application does not work at all. And so I'm not able to debug my code.

I'm thinking of increasing the Heap Size of system which is a Fedora Core 6, kernel 2.6.18
Please suggest is this a wise idea to increase the heap when there is problem debugging the code?

Also, suggest how can I increase the Heap Size of my machine?

Thanks and Regards,
Old 08-01-2007, 07:33 AM   #2
Registered: Jun 2006
Location: Mariposa
Distribution: Slackware 9.1
Posts: 938

Rep: Reputation: 30
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.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Increase Partition Size shane200_ Linux - Hardware 1 08-24-2006 01:06 PM
increase harddisk size.... yenonn Linux - General 1 10-14-2005 10:57 AM
Find out heap size for a PID luexiong Linux - General 1 03-29-2005 10:40 AM
increasing heap size podollb Linux - Software 3 03-07-2005 12:42 AM
increase point size size when printing PDF files newlin Red Hat 0 09-27-2003 08:13 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:13 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration