Warning: mysqli::__construct(): (HY000/1203): User howardkn already has more than 'max_user_connections' active connections in D:\Inetpub\vhosts\howardknight.net\al.howardknight.net\includes\artfuncs.php on line 21
Failed to connect to MySQL: (1203) User howardkn already has more than 'max_user_connections' active connections
Warning: mysqli::query(): Couldn't fetch mysqli in D:\Inetpub\vhosts\howardknight.net\al.howardknight.net\index.php on line 66
Article <v5e9li$1hil5$1@raubtier-asyl.eternal-september.org>
Deutsch   English   Français   Italiano  
<v5e9li$1hil5$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, 25 Jun 2024 13:28:51 +0200
Organization: A noiseless patient Spider
Lines: 28
Message-ID: <v5e9li$1hil5$1@raubtier-asyl.eternal-september.org>
References: <v4ojs8$gvji$1@dont-email.me>
 <v5e090$1fr82$1@raubtier-asyl.eternal-september.org>
 <v5e7m6$1gt2p$3@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 25 Jun 2024 13:28:51 +0200 (CEST)
Injection-Info: raubtier-asyl.eternal-september.org; posting-host="e5f07f45ab734ec04a76043ad492dd64";
	logging-data="1624741"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1/+1CMTnrN/1V8Yj30PtuOXtepE+4Q7+1w="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:hU2DdJRNFvLLqImcKc+eOrg2Lzc=
Content-Language: de-DE
In-Reply-To: <v5e7m6$1gt2p$3@dont-email.me>
Bytes: 2181

Am 25.06.2024 um 12:55 schrieb Vir Campestris:
> On 25/06/2024 09:48, Bonita Montero wrote:
>> Test this code with your Linux installation. For my installation
>> glibc does all realloc()ations in-place. Really surprising for me.
>>
>> #include <stdio.h>
>> #include <stdlib.h>
>>
>> int main()
>> {
>>      void *p = malloc( 0x100000000 );
>>      printf( "%p\n", p );
>>      p = realloc( p, 1 );
>>      printf( "%p\n", p );
>>      malloc( 0x100000000 - 0x10000 );
>>      p = realloc( p, 0x100000000 );
>>      printf( "%p\n", p );
>> }
> Try allocating a bunch of little items, and looking at where they are. 
> They'll likely be contiguous, or evenly spaced, depending on your 
> implementation and what "little" is.
> 
> Then resize them all. Some will move.
> 
> Andy.

The interesting part is that after doing the first realloc()
the memory being freee isn't reused for the next malloc().