|
-
May 23rd, 2008, 07:18 PM
#1
memory questions
Hello guys,
I have a question about the memory space.
Q1. Let's say I have a program that has 1 million of integer variables on 32-bit machine,
my understanding is this: 4 bytes * 1M = 4Mbs, and that at least 4Mbs of the machine's memory is taken by the programm, is this correct?
Q2. How do you figure out (in the begining part of the program design) the total memory usage?
Q2. I remember something about conventional and extended memory... (from the old days), is this still true? (I'm not quite sure what I'm asking here...)
thanks for the help!
-
May 23rd, 2008, 07:41 PM
#2
Re: memory questions
 Originally Posted by potatoCode
Hello guys,
I have a question about the memory space.
Q1. Let's say I have a program that has 1 million of integer variables on 32-bit machine,
my understanding is this: 4 bytes * 1M = 4Mbs, and that at least 4Mbs of the machine's memory is taken by the programm, is this correct?
At least 4MB will be taken by that data..
Q2. How do you figure out (in the begining part of the program design) the total memory usage?
Virtually impossible...
Code:
void f(int x)
{
if (x>10)
ptr = new int[10000];
else
ptr = new int[10];
}
Who much will that requre (without knowing the value of x...)
Q2. I remember something about conventional and extended memory... (from the old days), is this still true? (I'm not quite sure what I'm asking here...)
No that is pretty much gone (some very old embedded systems are the exception. Now the real issues ar L1 & L2 cache vs main memory...but that is a different story...
TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
2008, 2009,2010
In theory, there is no difference between theory and practice; in practice there is.
* Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions 
* How NOT to post a question here
* Of course you read this carefully before you posted
* Need homework help? Read this first
-
May 23rd, 2008, 09:22 PM
#3
Re: memory questions
Thanks TheCPUWizard,
you're always helpful!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|