public inbox for libc-help@sourceware.org
 help / color / mirror / Atom feed
* Q: System behaviour in out of memory situation
@ 2023-06-05  0:28 Konstantin Kharlamov
  2023-06-05  4:41 ` tomas
  2023-06-05  6:39 ` Florian Weimer
  0 siblings, 2 replies; 3+ messages in thread
From: Konstantin Kharlamov @ 2023-06-05  0:28 UTC (permalink / raw)
  To: libc-help

Hi, just 2 theoretic questions:

1. I know that calling malloc() only allocates a virtual memory, not a real one. It's kind of memory you can allocate Terabytes of, which some apps do (e.g. on my system electron has 1.1T allocated). It will only turn into a real memory by the kernel upon the app accessing it. But then, assuming OOM-killer is disabled, what happens if I try to access such virtual memory thus forcing it to turn into a real one, but the system is out of real memory ATM?
2. Is it unrealistic to expect ENOMEM from `malloc()`? That is because α) most systems have OOM-killer enabled, so instead of ENOMEM some app will get killed β) In absence of OOM-killer you'll get virtual memory successfully allocated, which returns us to 1.

P.S.: I asked 1st question on #glibc OFTC on Saturday as well, but got no reply still. So decided to give a try to the ML.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-06-05  6:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-05  0:28 Q: System behaviour in out of memory situation Konstantin Kharlamov
2023-06-05  4:41 ` tomas
2023-06-05  6:39 ` Florian Weimer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).