Click to See Complete Forum and Search --> : memory questions


potatoCode
May 23rd, 2008, 07:18 PM
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!

TheCPUWizard
May 23rd, 2008, 07:41 PM
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...

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...

thanks for the help!

:wave: :wave:

potatoCode
May 23rd, 2008, 09:22 PM
Thanks TheCPUWizard,

you're always helpful!