nixCraft Linux Forum

nixCraft

Linux / UNIX 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

Linux answers from nixCraft.


Coding in General Discussion on PHP/Perl/Python/Ruby/GNU C or C++. MySQL, PgSQL and (X)HTML or any other programming languages you want.

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-06-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
  #2 (permalink)  
Old 02-06-2005, 03:12 PM
rockdalinux's Avatar
Is that all you got?
User
 
Join Date: May 2005
Location: Planet Vegeta
OS: Redhat
Posts: 708
Thanks: 15
Thanked 19 Times in 18 Posts
Rep Power: 10
rockdalinux is a glorious beacon of light rockdalinux is a glorious beacon of light rockdalinux is a glorious beacon of light rockdalinux is a glorious beacon of light rockdalinux is a glorious beacon of light rockdalinux is a glorious beacon of light
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 02-06-2005, 03:18 PM
monk's Avatar
Senior Member
User
 
Join Date: Jan 2005
Location: Tibet
OS: Debian GNU/Linux
Posts: 506
Thanks: 0
Thanked 8 Times in 6 Posts
Rep Power: 7
monk has a spectacular aura about monk has a spectacular aura about
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 03-06-2005, 10:41 AM
Guest
 
Posts: n/a
Default

Thx rockdalinux and monk
Reply With Quote
Reply


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 Off


Similar Threads

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


All times are GMT +5.5. The time now is 01:15 PM.


Powered by vBulletin® Version 3.8.5 - Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2
©2005-2010 nixCraft. All rights reserved

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 37 38