From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from forward101a.mail.yandex.net (forward101a.mail.yandex.net [IPv6:2a02:6b8:c0e:500:1:45:d181:d101]) by sourceware.org (Postfix) with ESMTPS id 402063858D32 for ; Mon, 5 Jun 2023 00:28:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 402063858D32 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=yandex.ru Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=yandex.ru Received: from mail-nwsmtp-smtp-production-main-39.vla.yp-c.yandex.net (mail-nwsmtp-smtp-production-main-39.vla.yp-c.yandex.net [IPv6:2a02:6b8:c0d:31b:0:640:fdf8:0]) by forward101a.mail.yandex.net (Yandex) with ESMTP id 2A50D463BB for ; Mon, 5 Jun 2023 03:28:01 +0300 (MSK) Received: by mail-nwsmtp-smtp-production-main-39.vla.yp-c.yandex.net (smtp/Yandex) with ESMTPSA id 0SFgrmwDVa60-5c2wx59t; Mon, 05 Jun 2023 03:28:00 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1685924880; bh=nnEHxwtIzzOCv+IUGeA9ZV64JzbmiRflZSDn/50Dl3w=; h=Date:To:From:Subject:Message-ID; b=Qa5AhZr/HqTEtsQAE4ammL8ktoD2zcp8t9zyQ4qLPRHzoovSXq6qTa8eOFOOAgBjI RPOfw6+b7FWiVHnwJxGLxLK7BVt2eZq85VLFuqUinutpYlJeGR8KUvJPWTmlpS/6zD 3tWCSjEKN2g3mFQTROdOuMNbSctjRivHQmME6Lgg= Authentication-Results: mail-nwsmtp-smtp-production-main-39.vla.yp-c.yandex.net; dkim=pass header.i=@yandex.ru Message-ID: Subject: Q: System behaviour in out of memory situation From: Konstantin Kharlamov To: libc-help@sourceware.org Date: Mon, 05 Jun 2023 03:28:00 +0300 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.48.2 MIME-Version: 1.0 X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: 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 th= us 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 =CE= =B1) most systems have OOM-killer enabled, so instead of ENOMEM some app wi= ll get killed =CE=B2) In absence of OOM-killer you'll get virtual memory su= ccessfully allocated, which returns us to 1. P.S.: I asked 1st question on #glibc OFTC on Saturday as well, but got no r= eply still. So decided to give a try to the ML.