Help with malloc

A

AA

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
 
I

Ivan Vecerina

: 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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top