Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #17505

Re: malloc

From Keith Thompson <kst-u@mib.org>
Newsgroups comp.lang.c, comp.lang.c++
Subject Re: malloc
Date 2012-02-17 02:26 -0800
Organization None to speak of
Message-ID <ln62f5g3h8.fsf@nuthaus.mib.org> (permalink)
References <jhjr14$rjk$1@reader1.panix.com> <chine.bleu-CBABD5.13215116022012@news.eternal-september.org> <jhkaen$gvt$1@dont-email.me> <07552704-67e6-4ec8-9180-1aede4471a6a@1g2000yqv.googlegroups.com>

Cross-posted to 2 groups.

Show all headers | View raw


Goran <goran.pusic@gmail.com> writes:
> On Feb 17, 2:27 am, Eric Sosman <esos...@ieee-dot-org.invalid> wrote:
>> On 2/16/2012 4:21 PM, Devil with the China Blue Dress wrote:
>>
>> > In article<jhjr14$rj...@reader1.panix.com>, j...@panix.com (Joe keane) wrote:
>>
>> >> Bugs of memory allocation will make you mad.
>>
>> >> Bugs *in* memory allocation will put you in the cuckoo people place.
>>
>> > Which is why they are exceedingly rare. Nearly all allocation problems are due
>> > to the program storing outside array bounds.
>>
>>      The only allocator bug I have personally encountered was with
>> a malloc() implementation that never, never returned NULL.  When it
>> ought to have returned NULL, it crashed the program instead ...
>
> If you don't provide a way to verify that, it didn't happen ;-), and
> there was a bug in your code.

I suspect he's referring to the malloc() implementation
on typical Linux systems, which overcommits memory by default.
It can allocate a large chunk of address space for which no actual
memory is available.  The memory isn't actually allocated until
the process attempts to access it.  If there isn't enough memory
available for the allocation, the "OOM killer" kills some process
(not necessarily the one that did the allocation).

-- 
Keith Thompson (The_Other_Keith) kst-u@mib.org  <http://www.ghoti.net/~kst>
    Will write code for food.
"We must do something.  This is something.  Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

malloc jgk@panix.com (Joe keane) - 2012-02-16 21:04 +0000
  Re: malloc Devil with the China Blue Dress <chine.bleu@yahoo.com> - 2012-02-16 13:21 -0800
    Re: malloc BGB <cr88192@hotmail.com> - 2012-02-16 16:16 -0700
      Re: malloc Paavo Helde <myfirstname@osa.pri.ee> - 2012-02-17 14:46 -0600
        Re: malloc Joshua Maurice <joshuamaurice@gmail.com> - 2012-02-17 14:51 -0800
          Re: malloc BGB <cr88192@hotmail.com> - 2012-02-17 19:58 -0700
            Re: malloc Paavo Helde <myfirstname@osa.pri.ee> - 2012-02-18 02:18 -0600
              Re: malloc BGB <cr88192@hotmail.com> - 2012-02-18 01:58 -0700
              Re: malloc glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2012-02-18 15:30 +0000
            Re: malloc Kaz Kylheku <kaz@kylheku.com> - 2012-02-18 10:36 +0000
              Re: malloc BGB <cr88192@hotmail.com> - 2012-02-18 10:53 -0700
            Re: malloc William Ahern <william@wilbur.25thandClement.com> - 2012-02-18 16:43 -0800
              Re: malloc BGB <cr88192@hotmail.com> - 2012-02-18 20:03 -0700
                Re: malloc Miles Bader <miles@gnu.org> - 2012-02-19 12:49 +0900
                Re: malloc William Ahern <william@wilbur.25thandClement.com> - 2012-02-18 21:08 -0800
                Re: malloc "io_x" <a@b.c.invalid> - 2012-02-19 18:23 +0100
                Re: malloc William Ahern <william@wilbur.25thandClement.com> - 2012-02-18 21:06 -0800
                Re: malloc BGB <cr88192@hotmail.com> - 2012-02-18 23:06 -0700
      Re: malloc "Asger Joergensen" <Junk@Asger-P.dk> - 2012-02-19 15:54 +0000
        Re: malloc BGB <cr88192@hotmail.com> - 2012-02-19 09:37 -0700
    Re: malloc Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-02-16 20:27 -0500
      Re: malloc Goran <goran.pusic@gmail.com> - 2012-02-16 23:40 -0800
        Re: malloc Keith Thompson <kst-u@mib.org> - 2012-02-17 02:26 -0800
          Re: malloc Goran <goran.pusic@gmail.com> - 2012-02-17 04:01 -0800
            Re: malloc Keith Thompson <kst-u@mib.org> - 2012-02-17 09:25 -0800
              Re: malloc Joshua Maurice <joshuamaurice@gmail.com> - 2012-02-17 14:49 -0800
                Re: malloc glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2012-02-18 01:43 +0000
                Re: malloc Kaz Kylheku <kaz@kylheku.com> - 2012-02-18 02:04 +0000
                Re: malloc scott@slp53.sl.home (Scott Lurndal) - 2012-02-18 03:04 +0000
                Re: malloc Robert Wessel <robertwessel2@yahoo.com> - 2012-02-17 22:15 -0600
                Re: malloc Joshua Maurice <joshuamaurice@gmail.com> - 2012-02-17 23:48 -0800
              Re: malloc Kaz Kylheku <kaz@kylheku.com> - 2012-02-17 23:29 +0000
                Re: malloc William Ahern <william@wilbur.25thandClement.com> - 2012-02-17 15:42 -0800
                Re: malloc "io_x" <a@b.c.invalid> - 2012-02-19 18:24 +0100
                Re: malloc Kleuske <kleuske@nowhere.net> - 2012-02-19 20:41 +0000
                Re: malloc James Kuyper <jameskuyper@verizon.net> - 2012-02-19 18:05 -0500
                Re: malloc "io_x" <a@b.c.invalid> - 2012-02-20 12:24 +0100
                Re: malloc Kleuske <kleuske@nowhere.net> - 2012-02-20 13:56 +0000
                Re: malloc "io_x" <a@b.c.invalid> - 2012-02-20 15:14 +0100
                Re: malloc William Ahern <william@wilbur.25thandClement.com> - 2012-02-19 15:19 -0800
        Re: malloc Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-02-17 08:06 -0500
          Re: malloc Goran <goran.pusic@gmail.com> - 2012-02-18 07:57 -0800
            Re: malloc Keith Thompson <kst-u@mib.org> - 2012-02-18 10:57 -0800
            Re: malloc Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-02-19 08:51 -0500
      Re: malloc Noob <root@127.0.0.1> - 2012-02-17 11:44 +0100
        Re: malloc "Joachim Schmitz" <nospam.jojo@schmitz-digital.de> - 2012-02-17 17:05 +0100
          Re: malloc pete <pfiland@mindspring.com> - 2012-02-17 11:19 -0500
            Re: malloc Noob <root@127.0.0.1> - 2012-02-17 17:30 +0100
          Re: malloc James Kuyper <jameskuyper@verizon.net> - 2012-02-17 11:31 -0500
      Re: malloc scott@slp53.sl.home (Scott Lurndal) - 2012-02-17 20:31 +0000
        Re: malloc Joshua Maurice <joshuamaurice@gmail.com> - 2012-02-18 00:01 -0800
          Re: malloc scott@slp53.sl.home (Scott Lurndal) - 2012-02-18 17:07 +0000
            Re: malloc Joshua Maurice <joshuamaurice@gmail.com> - 2012-02-18 18:14 -0800
              Re: malloc scott@slp53.sl.home (Scott Lurndal) - 2012-02-19 17:14 +0000
  Re: malloc Goran <goran.pusic@gmail.com> - 2012-02-16 23:43 -0800
  Re: malloc "io_x" <a@b.c.invalid> - 2012-02-19 16:44 +0100

csiph-web