🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c.moderated
Article #2497

Re: void* type

#2497
From: Konrad Schwarz
Date: Thu, 04 Apr 1996 01:10
21 lines
1378 bytes
In article <4jr71q$h66@solutions.solon.com>, stanr@tiac.net (Stan Ryckman) writes:

|> >Better yet: unless memory is really tight, have it double the size.

|> Not necessarily better.  If you're at 40% of your machine's
|> physical memory, doubling could be a real performance killer.

40% * 2 = 80% < 1, so 40% is kind of a bad choice for an example :)

|> With my suggestion (add some amount to the size and realloc)
|> you will rapidly reach the max if the sizes arrive "randomly".

I'd like to point out that the
worst case behavior with linear increases is O (n) mallocs and O (n**2) copies,
where n is the maximum size of blocks encountered;
with doubling, it is O (ld n) mallocs and O (n) copies.

|> Any strategy here would involve knowing something about your
|> target system, I think, [...]

Konrad Schwarz
Technical Details
Message-ID: <4jv7iv$d75@solutions.solon.com>
Path: arc1-ca.pugleaf.net!solon.com!not-for-mail
References: <4iepre$ag7@solutions.solon.com> <4jckqc$a5o@solutions.solon.com> <4jibl5$89u@solutions.solon.com> <4jol6e$1rr@solutions.solon.com> <4jr71q$h66@solutions.solon.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!solon.com!not-for-mail
From: schwarz@mips.complang.tuwien.ac.at (Konrad Schwarz)
Newsgroups: comp.lang.c.moderated
Subject: Re: void* type
Date: 3 Apr 1996 19:10:55 -0600
Organization: TU Wien
Sender: clc@solutions.solon.com
Approved: clc@solutions.solon.com
Message-ID: <4jv7iv$d75@solutions.solon.com>
References: <4iepre$ag7@solutions.solon.com> <4jckqc$a5o@solutions.solon.com> <4jibl5$89u@solutions.solon.com> <4jol6e$1rr@solutions.solon.com> <4jr71q$h66@solutions.solon.com>
NNTP-Posting-Host: solutions.solon.com