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 <v5bbd3$rhao$2@dont-email.me>
Deutsch   English   Français   Italiano  
<v5bbd3$rhao$2@dont-email.me>

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

Path: ...!2.eu.feeder.erje.net!feeder.erje.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Lawrence D'Oliveiro <ldo@nz.invalid>
Newsgroups: comp.lang.c
Subject: Re: realloc() - frequency, conditions, or experiences about
 relocation?
Date: Mon, 24 Jun 2024 08:40:03 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 14
Message-ID: <v5bbd3$rhao$2@dont-email.me>
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>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 24 Jun 2024 10:40:05 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="3048fea01d51f9337586ac8e02824e6c";
	logging-data="902488"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX18+em28bzjCK4Sv7usPscyL"
User-Agent: Pan/0.158 (Avdiivka; )
Cancel-Lock: sha1:MQTEmnDn1hgbSZ9BNO+Fi9zKdls=
Bytes: 1802

On Fri, 21 Jun 2024 21:12:12 +0200, Bonita Montero wrote:

> Usually you don't resize the block with a few bytes ...

The usual way I use realloc is to maintain separate counts of the number 
of array elements I have allocated, and the number I am actually using. A 
realloc call is only needed when the latter hits the former. Every time I 
call realloc, I will extend by some minimum number of array elements (e.g. 
128), roughly comparable to the sort of array size I typically end up 
with.

And then when the structure is complete, I do a final realloc call to 
shrink it down so the size is actually that used. Is it safe to assume 
such a call will never fail? Hmm ...