calloc()

  • Thread starter Michael McGarry
  • Start date
H

Herbert Rosenau

Is there anything I can do to fix that?

I guess if there is not contiguous memory of the size I need I am out
of luck?
Yes. But wait.....

It is possible that yxou can get more memory when the addressroom you
can use is not already full but the system can't give you more yet
because other processes are eaten anything. Then you may simply wait a
bit to get what you need. It depends on your system.

When "out of memory" is critical you may be able to find a way around
that by reorganising the memory you have in use. Save data, free
memory, alloc it again,.........

--
Tschau/Bye
Herbert

Visit http://www.ecomstation.de the home of german eComStation
eComStation 1.2 Deutsch ist da!
 
H

Herbert Rosenau

Would Linux, in default, ever return NULL? The default is to return
pointers to memory that is not even available : optimistic
strategy. Yuck :) I might, time allowing, knock up a program to fragment
up the memory and then try a huge alloc.

Q: does the swapfile come on "seamlessly" on most platforms here? In
which case would we ever see malloc failing assuming enough swap? How
does that work (yes I know OT)? Even if the swap is fragmented is the
memory block contiguous?
The swapper will be transparent as it replaces lacking physical memory
with logical ones.

malloc will fail when there is no more logical memory available. That
is:
- virtual memory space is out because the physical addressspace the
system can access is used
- the virtual addressroom an app can use is full


--
Tschau/Bye
Herbert

Visit http://www.ecomstation.de the home of german eComStation
eComStation 1.2 Deutsch ist da!
 

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

Members online

No members online now.

Forum statistics

Threads
473,992
Messages
2,570,220
Members
46,807
Latest member
ryef

Latest Threads

Top