473,378 Members | 1,401 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Stack-based Memory Questions

Hello

I am reading up a bit on how memmory is used in the .NET Framework and have a few question
about the stack-based approach

* I understand that the stack is used to provide a layer of abstractio
between the CLR and the underlaying memory hardware (porting to anothe
architecture should not change the program, i.e you dont work with register
directly)

* I understand that the stack help create variable scope, since it only exist a
long as the defining object (method etc) lives in the stack - once poped the variabl
goes out of scope

* What about the following cod

int a = 1
// ten other calls which is added to the stack, leaving a as the 11t
// stack element
int b = a

Does the stack have to be poped all the way down to the position wher
a is stored, and then push back the stack contents again? I dont see this a
a probable solution which makes me think the stack might support "non traditional
access? Can the CLR read from any stack position (Peek(int frame)) or what

* The same goes for the memory management - the GC looks for active reference
from to the objects on the stack. Does the application roots hold "duplicate information
on references - That is once a reference type is pushed to the stack, it is also assigned t
an application root. And likewize - when a reference type pops of the stack, does th
associated application root get cleared (if so there are there any reference counting bein
done in the root to know that ALL refrences to an objekt on the heap isn't on the stack an
more, so it is not cleared prematurly)

I've read that the stack-based look up should be (slightly) faster then the heap lookups
which means there should be an alterate way of reading the stack (not yourself but fo
the CLR / GC). Of course the stack is local to a thread and the heap is not, so I guess som
kind of locking is needed to ensure the contents of the heap is threadsafe

All and any feedback on this will be a big help

Cheers..
Jul 21 '05 #1
0 1250

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

Similar topics

10
by: Shuo Xiang | last post by:
Greetings: I know that variables declared on a stack definitely does not reside in heap space so there is only a very limited amount of stuff that you can store in the stack of a function. But...
8
by: LedZep | last post by:
What up everyone, I have to write a program that uses a stack to determine whether a string is a palindrome (a string that is spelled identically backward and forward). The program has to...
4
by: alisaee | last post by:
plz check what i have made wrong what is requierd her is to creat class queue and class stack and run the push,pop operation . #include<iostream.h> #include<conio.h> #include<stdio.h> class...
5
by: srikanth | last post by:
is it possible not to decrement the top variable after we remove(or retreive) a file from a stack >MY IDEA is:> if top is not decremented the stack is like it has some files existing in it with...
24
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...
1
by: alfie27 | last post by:
I currently have a working program that is a stack that stores integers. Now i have to convert it to store strings instead of integers. I have been working on this for hours and just keep getting...
11
by: tom | last post by:
Hi! Im new to Python and doing exercise found from internet. It is supposed to evaluate expression given with postfix operator using Stack() class. class Stack: def __init__(self): self.items...
2
by: AZRebelCowgirl73 | last post by:
I have casted the stack so that it will print however now it does print like required however it includes un-needed stuff! (Point2D.Double) (Point 2D.Double) (Point2D.Double) (Point2D.Double)...
9
by: Tarique | last post by:
Hello all.I am trying to implement a stack which can store either integer or float values. The code is given below: #include<stdio.h> #include<stdlib.h> #include<string.h> #define...
87
by: CJ | last post by:
Hello: We know that C programs are often vulnerable to buffer overflows which overwrite the stack. But my question is: Why does C insist on storing local variables on the stack in the first...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.