Deutsch English Français Italiano |
<v5cihu$13b6q$1@raubtier-asyl.eternal-september.org> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!feeds.phibee-telecom.net!news.mixmin.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!raubtier-asyl.eternal-september.org!.POSTED!not-for-mail From: Bonita Montero <Bonita.Montero@gmail.com> Newsgroups: comp.lang.c Subject: Re: realloc() - frequency, conditions, or experiences about relocation? Date: Mon, 24 Jun 2024 21:48:16 +0200 Organization: A noiseless patient Spider Lines: 28 Message-ID: <v5cihu$13b6q$1@raubtier-asyl.eternal-september.org> References: <v4ojs8$gvji$1@dont-email.me> <v4ov8h$j2q2$1@raubtier-asyl.eternal-september.org> <v52270$2nli8$1@dont-email.me> <v54jac$3a4p2$1@raubtier-asyl.eternal-september.org> <v5bbd3$rhao$2@dont-email.me> <875xtyu0kk.fsf@nosuchdomain.example.com> <v5bluo$thpd$1@dont-email.me> <v5chlg$12vsd$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Mon, 24 Jun 2024 21:48:15 +0200 (CEST) Injection-Info: raubtier-asyl.eternal-september.org; posting-host="25e5eda89458a83976f4ab5b7ad682c9"; logging-data="1158362"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+DmJkWnmexYXgv31RSYUDywL50FSGUjFk=" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:xlr31NPo/ac1sOuCqu6YDh4+mM0= In-Reply-To: <v5chlg$12vsd$1@dont-email.me> Content-Language: de-DE Bytes: 2613 Am 24.06.2024 um 21:33 schrieb Chris M. Thomasson: > On 6/24/2024 4:40 AM, David Brown wrote: >> On 24/06/2024 11:55, Keith Thompson wrote: >> >>> Something else that occurs to me: If a shrinking realloc() never fails >>> in practice, then any code you write to handle a failure won't be >>> tested. >>> >> >> That is always a problem with allocation functions. Have you ever >> known a non-pathological malloc() to fail? >> >> I think, in fact, there's a good argument for ignoring the possibility >> of malloc (and calloc and realloc) failures for most PC code. There >> is virtually no chance of failure in reality, and if you get one, >> there is almost never a sensible way to deal with it - > [...] > > I have had to deal and roll with malloc failures. It put the server in > panic mode and it started killing connections that were already timed > out, dumping some caches (freelists of regions, ect), ect... There is a > way to recover. > There are applications where you can ignore malloc()-failures / bad_alloc since they only allocate a small amount of memory or a lot of small allocations which sum up to a small amount of memory.