Is code loaded into the heap or the stack? or both? can the programmer control that?
Type: Posts; User: butteflymentor
Is code loaded into the heap or the stack? or both? can the programmer control that?
I have a 20KB program which I programmed myself, I never use malloc or any other heap memory allocation function, yet the Task Manager shows a usage of 2.7MB, how do you explain this? The program is...
I admit that there is not a single logical argument against this, guess it does make sense :P
Thanks for the help.
Android or IOS? Android.
Linux or Windows? Linux.
DirectX or OpenGL? OpenGL.
Opensource ftw!
So, A pretty huge video game, such as Assassin's Creed would use 1MB of stack memory and the rest is handled by the heap? That doesn't make sense at all.
Another example would be svchost.exe, It is...
If all Windows programs allocate 1MB of stack memory, how come the Windows Task Manager shows a different RAM usage for each program? What do these numbers represent?
It's working flawlessly now (without initializing ignored and reserved members).
Thank you guys!
Some members are ignored unless there is a specific flag in the "flags" member, I don't need to initialize these, do I?Also, do I need to initialize members which are marked "Reserved" by MSDN?
I have some general programming questions:
A stack overflow occurs when the stack gets "too big", so, how much is too big?
Does the run-time stack have a specific size like an array? if so, how...
Here is what I learned by searching online, please correct me if I'm wrong:
When a variable is declared, the stack pointer is advanced forward, but the values of the memory cells are unchanged. so...
Very useful information,Thank you guys!
Interesting, could you please explain that further? Is it necessary to initialize all variables in C structures? Also, I don't believe that not passing...
Hello, I have a very strange issue. I am new to Win32 programming, therefore I am probably doing something wrong.
I wrote a function which reads text from a file selected by the user, then puts that...
I understand that when a program runs, it stores data (like variables) and also instructions which act upon that data in the RAM. The CPU executes the instructions, and the data is played around with...
Great analogy! The only difference is that the compiler failed to arrest me, and i managed to get away with it :P
I am not sure. I downloaded the Code::Blocks version which includes a read-to-use Mingw. Oddly, it does not state which version of Mingw is included.
The Readme says: "4.4.1-tdm-2"... I am not sure...
Any idea how to achieve that in Code::blocks?
I checked all boxes in: Settings > Compiler And Debugger > Compiler Settings > Compiler Flags > Categories:Warnings. Yet the error is still not being...
Exactly! what compiler did you use? The compiler I am using (mingw) does not detect this error.
EDIT: that was a silly question. The first line says "Gcc" :D
Is my assumption incorrect? I don't see how "a function's local variables remain in the stack" differs from "the memory that they occupied remains".
I was expecting the compiler to throw an error or something.
This time, I ran this modified code:
#include <stdio.h>
#include <stdlib.h>
Is it possible that the function "testfunc()" is returning a COPY of the array "x" ? Edit: The answer is no.
Many websites say that C arrays are stored in the Stack, unless malloc() is used. If that is true, then an array is supposed to be destroyed after a function ends. However, I ran a test that...