hi!
so in c++ it's very easy. you want whatever class/struct to be allocated on the heap, use new. if you want it on the stack, don't use new.
in C# we always use the new keyword, and depending on whether it's a struct or a class it's allocated either on the stack or on the heap (structs go to the stack, classes to the heap) - and in s...
I know that in the architectures I'm personally familiar with (x86, 6502, etc), the stack typically grows downwards (i.e. every item pushed onto the stack results in a decremented SP, not an incremented one).
I'm wondering about the historical rationale for this. I know that in a unified address space, it's convenient to start the stac...
Forgive me if this is a silly question but I'm afraid that I don't know what 'the stack' is.
I know what 'a stack' is and I've learned the FILO/FIFO acronyms. But when people say things like 'a value type is allocated on the stack, not the heap' - I'm afraid I don't really know what that means.
When I introduce a logic error into a ...
How do I restore the stack trace function name instead of <UNKNOWN>?
Event Type: Error
Event Source: abcd
Event Category: None
Event ID: 16
Date: 1/3/2010
Time: 10:24:10 PM
User: N/A
Computer: CMS01
Description:
Server.exe caused a in module at 2CA001B:77E4BEF7
Buil...
I have a simple bootloader, which initializes and prepares SDRAM. Then it loads an application from the Flash and starts it at some address in the RAM. After the application has finished its execution, the system does restart. There is no system stack.
Now, I would like this bootloader receives control back after an application finished...
While coding should we consider some limit on the total size of variables created on the stack? If yes, on what basis should we decide it? Is it dependent on OS, Memory Availability etc? Are there any compiler options which can check this?
Any pointers in the direction will also be helpful.
...
How can I locate which areas of memory of a Win32 process contain the global data and the stack data for each thread?
...
What is the best correct way of implementing a dynamically resizing stack in C?
For example, i want to allocate an amount of memory to a stack but when that stack gets full, the memory allocated is doubled to accomodate new data, etc.
I have a stack implemented at the minute using a simple array of void pointers, this way i can store p...
My understanding of calculators is that they are stack-based. When you use most calculators, if you type 1 + 2 [enter] [enter] you get 5. 1 is pushed on the stack, + is the operator, then 2 is pushed on the stack. The 1st [enter] should pop 1 and 2 off the stack, add them to get 3 then push 3 back on the stack. The 2nd [enter] shouldn't ...
I have
class Foo {
....
}
Is there a way for Foo to be able to separate out:
function blah() {
Foo foo; // on the stack
}
and
function blah() {
Foo foo* = new Foo(); // on the heap
}
I want Foo to be able to do different things depending on whether it's allocated on the Stack or the Heap.
Edit:
Alof of people have asked m...
Hi,
I know that every running process has pages associated with it in virtual memory and few of them will be loaded into main memory as required. I also know that program will have a stack and also a heap to allocate dynamic memory. Here are my questions.
Is stack also part of some page in main memory?
What happens when the program is...
I have a python program that uses a custom-built DLL. This DLL crashes due to a stack overflow. This overflow is not due to a recursive function gone bad, but to large allocations on the stack using alloca().
I want to increase stack size to get rid of this error. Is there any way to do this?
...
Following my question yesterday, I tried to learn a bit more about the architecture of call stacks. Online and SO searches have not yielded the answer I'm looking for, which could be because I don't know precisely which keywords to use. Anyway, I'm sure someone here can help me...
First, lets start with an excerpt from Wikipedia's entry...
Why and when should I use stack or queue data structures instead of arrays/lists? Can you please show an example for a state thats it'll be better if you'll use stack or queue?
Thanks.
...
With reference to Stack Based Memory Allocation, it is stated as "...each thread has a reserved region of memory referred to as its stack. When a function executes, it may add some of its state data to the top of the stack; when the function exits it is responsible for removing that data from the stack" and "...that memory on the stack i...
In matlab one can use dbstack to retrieve the call stack at the current time, however dbstack is not available in standalone compiled versions of matlab programs, is there an alternative to get the call stack, or at least the function calling the current function? I want to write a facility function that needs to know by who it was calle...
I have a UINavigationController . I have to pop a view from a UINavigationController and replace it with another. How we can search for a UIviewcontroller object and replace it with another ?
when i print
NSMutableArray *allViewControllers = [NSMutableArray arrayWithArray: myDelegate.navigationController.viewControllers];...
I am working on a small bootloader for learning purposes. Is there any specification/information available about the (free) stack size required for a bios interrupt call?
...
I have a pretty simple setup. To sum it up here's what I'm doing:
class Movie
include MongoMapper::Document
has_one :setting
end
class Setting
include MongoMapper::EmbeddedDocument
belongs_to :movie
end
What I want to do is to update the setting of a movie in the same form as the movie other information. Therefor I do that :
...
I have a process that calls an event when its done.
void DoProcess()
{
...
...
// Call finished event
OnFinished();
}
I want to run this process many times.
My first idea was to recall the process each time the 'Finished' event was called.
void obj_Finished()
{
DoProcess();
}
Would this mean that the st...