🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: void* type

#2483
From: telnet user
Date: Wed, 03 Apr 1996 13:12
25 lines
1860 bytes
msb@sq.com wrote:
: > > The realloc can certainly do something like use sz+10000
: > > to "grow" the tmp area in tunable chunks, depending on the application.
: > 
: > Better yet: unless memory is really tight, have it double the size.
: > This will set a fairly reasonable upper bound on the number of reallocs
: > you will have to do.

: Better yet: change "unless memory is really tight" to "if memory is
: plentiful".  The doubling method can run out of memory when the amount
: available is almost twice the amount that you need, not even considering
: the possibility of fragmentation.

Of course, if temporary realloc'ed buffers are a significant
percentage of a program's memory usage, it's design should be
rethought anyway ...

Under normal circumstances, O(log N) reallocs beats O(N) reallocs any
day (where N is the largest size buffer needed).

---------------------------------------------------------------------------
Tim Hollebeek         | Disclaimer :=> Everything above is a true statement,
Electron Psychologist |                for sufficiently false values of true.
Princeton University  | email: tim@wfn-shop.princeton.edu
----------------------| http://wfn-shop.princeton.edu/~tim (NEW! IMPROVED!)
Technical Details
Message-ID: <4jttgp$3nh@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> <4jq1o1$a8v@solutions.solon.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!solon.com!not-for-mail
From: tim@franck.Princeton.EDU (telnet user)
Newsgroups: comp.lang.c.moderated
Subject: Re: void* type
Date: 3 Apr 1996 07:12:57 -0600
Organization: Princeton University
Sender: clc@solutions.solon.com
Approved: clc@solutions.solon.com
Message-ID: <4jttgp$3nh@solutions.solon.com>
References: <4iepre$ag7@solutions.solon.com> <4jckqc$a5o@solutions.solon.com> <4jibl5$89u@solutions.solon.com> <4jol6e$1rr@solutions.solon.com> <4jq1o1$a8v@solutions.solon.com>
Reply-To: tim@wagner.Princeton.EDU
NNTP-Posting-Host: solutions.solon.com
X-Newsreader: TIN [version 1.2 PL2]