CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2008
    Location
    California, USA
    Posts
    822

    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!

  2. #2
    Join Date
    Mar 2002
    Location
    St. Petersburg, Florida, USA
    Posts
    12,125

    Re: memory questions

    Quote 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...
    thanks for the help!
    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

  3. #3
    Join Date
    Jan 2008
    Location
    California, USA
    Posts
    822

    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
  •  





Click Here to Expand Forum to Full Width

Featured