Deutsch   English   Français   Italiano  
<v4rein$18e5u$1@raubtier-asyl.eternal-september.org>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!feed.opticnetworks.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: Tue, 18 Jun 2024 09:56:07 +0200
Organization: A noiseless patient Spider
Lines: 12
Message-ID: <v4rein$18e5u$1@raubtier-asyl.eternal-september.org>
References: <v4ojs8$gvji$1@dont-email.me> <875xu8vsen.fsf@bsb.me.uk>
 <v4ovqf$j5hq$1@dont-email.me> <87zfrjvqp6.fsf@bsb.me.uk>
 <v4pb4v$lhgk$1@dont-email.me> <87h6dr16md.fsf@nosuchdomain.example.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 18 Jun 2024 09:56:07 +0200 (CEST)
Injection-Info: raubtier-asyl.eternal-september.org; posting-host="685e4851f2faab722862bf26e2e83cf9";
	logging-data="1325246"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX181DTpI8/It2wf9D781vFz33DdTUFmYBqA="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:341FV8FR3d6lmnAedeTP21wy6ZY=
Content-Language: de-DE
In-Reply-To: <87h6dr16md.fsf@nosuchdomain.example.com>
Bytes: 1841

Am 18.06.2024 um 01:39 schrieb Keith Thompson:

> I have a small test program that uses realloc() to expand a 1-byte
> allocated buffer to 2 bytes, then 3, then 4, and so on.  In one
> implementation, in one test run, it reallocates at 25 bytes, and
> then not again until just over 128 kbytes.  Other implementations
> behave differently.

Usually you don't expand a dynamic array byte per byte. Normaly you
expand it like a C++ vector whose capacity doubles with libstdc++
and libc++ (MSVC adds 50% to the capacity before).