Path: csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: VC++ 2013, malloc() and free() Date: Thu, 27 Oct 2016 17:06:48 -0700 Organization: None to speak of Lines: 27 Message-ID: References: <50ddf174-e477-4b57-b576-a17623b2ce68@googlegroups.com> <20161025172315.44bb53a4@maxa-pc.cpe.bvcom.net> <52ae27e2-0157-4f29-8ca8-cbd656f32247@googlegroups.com> <58125aaa.7762265@news.xs4all.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: mx02.eternal-september.org; posting-host="89bfc0b94011e6293dc6229ff1f432ac"; logging-data="18390"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19A+minZXv5RCO9NzKapyKK" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:XQBP/ljgr7IiMQdl7/EwpJTTKuQ= sha1:4+m4SHHpQVmjIGlwe1TW1q8p3SU= Xref: csiph.com comp.lang.c:95354 supercat@casperkitty.com writes: > On Thursday, October 27, 2016 at 2:55:05 PM UTC-5, Richard Bos wrote: >> No. Which, IYAM, makes overcommitting systems blatantly and insultingly >> non-conforming. > [...] > To forbid an > implementation from dying if a program tries to malloc() too much storage > would severely constrain the useful behaviors of C compilers on many machines > (a compiler for any platform could statically allocate a pool and limit > malloc to using that, but for many purposes being able to request more > unless or until things die is actually more useful). Overcommitting isn't about a program dying when it tries to malloc() too much storage. It's about a program (or some other process on the system) dying when it (a) attempts to allocate memory by calling malloc(), (b) gets back a non-null pointer indicating that malloc() succeeded, *and then* (c) tries to access that memory. Perhaps you already knew that, but it wasn't clear from what you wrote above. -- Keith Thompson (The_Other_Keith) kst-u@mib.org Working, but not speaking, for JetHead Development, Inc. "We must do something. This is something. Therefore, we must do this." -- Antony Jay and Jonathan Lynn, "Yes Minister"