473,508 Members | 2,265 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Stack/Heap?

I am trying to find out how items on the stack are
stored, is it a FILO or a FIFO? Also what about the heap?

I ask as I have found two articles one stating that the
stack is stored as FILO and another saying FIFO!! and I
cant seem to find a definitive statement in MSDN

Can someone please clear this up for me

Thanks!
Nov 15 '05 #1
2 1754
Well, consider a stack of dishes, you put new ones on top, and remove the
topmost ones when you need them.
This is how the cpu uses the its stack, First In, Last Out. I'm not sure
how the framework stack works, or if it is a conventional stack at all.
The heap is just that, a bunch of memory, items are stored at the first
available spot, but the position may change based on deletion of earlier
objects. The framework tries to keep all the used memory in one place so
new memory allocation can be speeded up.
This article may clarify some of it:

http://www.msdnaa.net/Resources/Display.aspx?ResID=601

--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
Nov 15 '05 #2
The Stack class is implemented as a LIFO (Last In First Out). The Queue
class is implemented as FIFO (First In First Out).

See the following article about more information:
http://www.microsoft.com/belux/fr/ms...ens/collection
s1.mspx#Stack%20Class

--
Greetz

Jan Tielens
________________________________
Read my weblog: http://weblogs.asp.net/jan
"tonyhall" <an*******@discussions.microsoft.com> wrote in message
news:01****************************@phx.gbl...
I am trying to find out how items on the stack are
stored, is it a FILO or a FIFO? Also what about the heap?

I ask as I have found two articles one stating that the
stack is stored as FILO and another saying FIFO!! and I
cant seem to find a definitive statement in MSDN

Can someone please clear this up for me

Thanks!

Nov 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
30069
by: Kevin Grigorenko | last post by:
Hello, I couldn't find an obvious answer to this in the FAQ. My basic question, is: Is there any difference in allocating on the heap versus the stack? If heap or stack implementation is not...
17
5003
by: Jonas Rundberg | last post by:
Hi I just started with c++ and I'm a little bit confused where stuff go... Assume we have a class: class test { private: int arr; };
1
3757
by: Geiregat Jonas | last post by:
I'm reading Eric Gunnerson's book. He is talking about the heap and stack, he says you have 2types, value wich are in the stack or inline or reference types wich are in the heap. I don't get...
2
2844
by: Nick McCamy | last post by:
I have a question related to allocating on the stack. In this program below, are my following assumptions true? - variable a is allocated on the heap since it's static - variable b is...
3
1702
by: nahur | last post by:
why do you need a heap and a stack why not all memory called a heap or call it a stack what is the purpose of having a heap and a stack
13
2281
by: gmccallum | last post by:
General Info: A struct is stored on the stack and a class on the heap. A struct is a value type while a class is a reference type. Question: What if a struct contains a string...
9
3356
by: shine | last post by:
what is the difference between a heap and a stack?
24
2838
by: arcticool | last post by:
I had an interview today and I got destroyed :( The question was why have a stack and a heap? I could answer all the practical stuff like value types live on the stack, enums are on the stack, as...
16
4421
by: sarathy | last post by:
Hi all, I need a few clarifications regarding memory allocaion in C++. I apologize for the lengthy explanation. 1. In C++, Objects are allocated in heap. What does heap refer to? Is it an area...
9
3143
by: Roman Mashak | last post by:
Hello, I'm confused about heap and stack memories management in C language. Most books explain that local stack variables for each function are automatically allocated when function starts and...
0
7231
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7336
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7401
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7504
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5640
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4720
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3211
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3196
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1568
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.