nixCraft Linux Forum

nixCraft

Linux Tech Support Forum

What is heap and how it is a related with gcc?

This is a discussion on What is heap and how it is a related with gcc? within the Coding in General forums, part of the Development/Scripting category; Whenever I read the man page of gcc or other help/books I found the term heap, buffer, stack etc all ...


Go Back   nixCraft Linux Forum > Development/Scripting > Coding in General

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 06-02-2005, 12:59 PM
Guest
 
Posts: n/a
Default What is heap and how it is a related with gcc?

Whenever I read the man page of gcc or other help/books I found the term heap, buffer, stack etc all of these terms are same or different or they are just referring the memory we allocate using malloc or calloc? Looking for simple clarification
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 06-02-2005, 03:12 PM
rockdalinux's Avatar
Contributors
User
 
Join Date: May 2005
Location: Bangalore
My distro: RHEL, HP-UX, Solaris, FreeBSD, Ubuntu
Posts: 557
Rep Power: 6
rockdalinux is a jewel in the rough rockdalinux is a jewel in the rough rockdalinux is a jewel in the rough
Default

Memory
-----------------
c code (bin) --> 1
-----------------
static data --> 2
-----------------


stack --> 3


-----------------
Heap --> 4
-----------------

1) Machine instruction aka your compiled C code
2) Gloable variable, static variables (variables which exists throught program)
3) Dynamically allocated storage (linked list created using malloc())
4) Info about function call in your code

Hope this clears the picture
Reply With Quote
  #3 (permalink)  
Old 06-02-2005, 03:18 PM
monk's Avatar
Senior Member
User
 
Join Date: Jan 2005
Location: Tibet
My distro: Debian GNU/Linux
Posts: 481
Rep Power: 5
monk will become famous soon enough monk will become famous soon enough
Default

rockdalinux that is pretty good picture of how program looks when loaded in memory? And to add to that info

A Buttfer is a block of memory that holds "multiple instances of the same data type"

A Heap It is a space a program reserves for a variable. (You access the heap when you use the malloc() function).

So all of them are NOT the same...
Reply With Quote
  #4 (permalink)  
Old 06-03-2005, 10:41 AM
Guest
 
Posts: n/a
Default

Thx rockdalinux and monk
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

Thread Thread Starter Forum Replies Last Post
Issue related to shells vaibhav.kanchan Getting started tutorials 4 03-25-2008 12:52 AM
its related to linux , interrupts.. venkateswarlu Coding in General 3 12-11-2007 05:28 PM
How to get xen related api's in Suse sles10 sp1 namitha XEN 1 12-05-2007 03:12 PM


All times are GMT +5.5. The time now is 05:22 AM.


Powered by vBulletin® Version 3.7.2 - Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36