Help with malloc

Discussion in 'C++' started by AA, Feb 1, 2007.

  1. AA

    AA Guest

    If a program is allocating memory in a loop, how to determine what is
    maximum memory allocation limit after which there will be out of
    memory eror ?
    Is malloc operation is user-mode or kernel-mode?

    Thanks in advance!
    Artami
     
    AA, Feb 1, 2007
    #1
    1. Advertising

  2. "AA" <> wrote in message
    news:...
    : If a program is allocating memory in a loop, how to determine what is
    : maximum memory allocation limit after which there will be out of
    : memory eror ?

    This is totally platform-dependent, and there is no way to predict
    the available amount of memory using the standard C or C++ libraries
    -- except by actually attempting the allocation.
    malloc will return 0/NULL once it fails (while operator new
    will throw an out-of-memory exception).

    : Is malloc operation is user-mode or kernel-mode?

    Again, this is a platform-dependent detail, and needs to
    be looked up in the documentation of your library/compiler.
    Try a platform-specific newsgroup, you might get an answer
    there...

    hth-Ivan
    --
    http://ivan.vecerina.com/contact/?subject=NG_POST <- email contact form
    Brainbench MVP for C++ <> http://www.brainbench.com
     
    Ivan Vecerina, Feb 1, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John
    Replies:
    13
    Views:
    708
  2. ravi
    Replies:
    0
    Views:
    455
  3. Peter
    Replies:
    34
    Views:
    1,961
    Richard Tobin
    Oct 22, 2004
  4. porting non-malloc code to malloc

    , Feb 18, 2005, in forum: C Programming
    Replies:
    3
    Views:
    484
    Walter Roberson
    Feb 19, 2005
  5. Johs32

    to malloc or not to malloc??

    Johs32, Mar 30, 2006, in forum: C Programming
    Replies:
    4
    Views:
    327
    Captain Winston
    Mar 30, 2006
Loading...

Share This Page