🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: void* type

#2512
From: J. Kanze
Date: Fri, 05 Apr 1996 00:37
27 lines
1844 bytes
In article <4jq1o1$a8v@solutions.solon.com> msb@sq.com writes:

|> > > 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.

I guess it depends on the definition of `really tight'.  Now that most
machines have virtual memory, I tend to only consider two situations:
`memory is really tight' (no virtual memory) or `memory is plentiful'
(virtual memory).

You're right, of course, in that it is one aspect to consider.  (I
suppose you could also add code that when doubling failed, you tried 1.5
times, then 1.25, then...:-)
-- 
James Kanze           (+33) 88 14 49 00          email: kanze@gabi-soft.fr
GABI Software, Sarl., 8 rue des Francs Bourgeois, 67000 Strasbourg, France
Conseils en informatique industrielle --
                            -- Beratung in industrieller Datenverarbeitung
Technical Details
Message-ID: <4k1q12$58j@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>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!solon.com!not-for-mail
From: kanze@gabi-soft.fr (J. Kanze)
Newsgroups: comp.lang.c.moderated
Subject: Re: void* type
Date: 4 Apr 1996 18:37:54 -0600
Organization: GABI Software, Sarl.
Sender: clc@solutions.solon.com
Approved: clc@solutions.solon.com
Message-ID: <4k1q12$58j@solutions.solon.com>
References: <4iepre$ag7@solutions.solon.com> <4jckqc$a5o@solutions.solon.com>
 <4jibl5$89u@solutions.solon.com> <4jol6e$1rr@solutions.solon.com>
NNTP-Posting-Host: solutions.solon.com