Mail Archives: djgpp/2004/03/03/07:15:57
X-Authentication-Warning: | delorie.com: mail set sender to djgpp-bounces using -f
|
Message-ID: | <4045C364.41EFB535@yahoo.com>
|
From: | CBFalconer <cbfalconer AT yahoo DOT com>
|
Organization: | Ched Research
|
X-Mailer: | Mozilla 4.75 [en] (Win98; U)
|
X-Accept-Language: | en
|
MIME-Version: | 1.0
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Re: Speed of free()
|
References: | <40457b5c DOT 5675949 AT localhost>
|
Lines: | 33
|
Date: | Wed, 03 Mar 2004 12:01:54 GMT
|
NNTP-Posting-Host: | 12.76.139.168
|
X-Complaints-To: | abuse AT worldnet DOT att DOT net
|
X-Trace: | bgtnsc04-news.ops.worldnet.att.net 1078315314 12.76.139.168 (Wed, 03 Mar 2004 12:01:54 GMT)
|
NNTP-Posting-Date: | Wed, 03 Mar 2004 12:01:54 GMT
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Reply-To: | djgpp AT delorie DOT com
|
Scott wrote:
>
> Is there a FAQ about malloc/free performance? I'm having speed
> problems when freeing a large number of small blocks (where
> large == a million or so, and small == 48 bytes).
>
> I have an AMD Duron 900MHz, 384k RAM, Win98SE; DJGPP 2.03, gcc
> 3.3.2; go32-v2 shows 258901k mem/30659k swap available. On this
> machine, a sample set of about 400,000 blocks takes about two
> minutes to free. The same program on a less powerful machine
> running FreeBSD (4.3R, P3-450, 128k, gcc 2.95.3) takes 3.5 seconds.
This is why I wrote nmalloc, which may some day appear in DJGPP
2.04. It is missing the memalign operation. Available at:
<http://cbfalconer.home.att.net/download/nmalloc.zip>
and it makes that free operation O(N) instead of O(N*N), by making
the individual free operations O(1).
To use it in your applications, simply prepare nmalloc.o with the
various debuggeries turned off, and link it before the library
search. In fact, you can even use it with the debuggery enabled,
which is why the debug methods are as they are. malloc is used
during execution of the initialization code, long before main is
executed.
--
Chuck F (cbfalconer AT yahoo DOT com) (cbfalconer AT worldnet DOT att DOT net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net> USE worldnet address!
- Raw text -