delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/09/16/10:52:43

Message-Id: <199909161257.PAA07940@ankara.Foo.COM>
From: "S. M. Halloran" <mitch AT duzen DOT com DOT tr>
Organization: User RFC 822- and 1123-compliant
To: djgpp AT delorie DOT com
Date: Thu, 16 Sep 1999 17:02:46 +0200
MIME-Version: 1.0
Subject: Re: Why malloc() and free() take so much time ?
In-reply-to: <37E0B563.67698DE8@accord-soft.com>
X-mailer: Pegasus Mail for Win32 (v3.12)
Reply-To: djgpp AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On 16 Sep 99, Sunil V. was found to have commented thusly:

> Hello Everybody,
> 
>      A piece of my code looks as follows:
> 
> 
>     AllocateHugeBlock()
>       -----
>       -----
>       -----
>     FreeHugeBlock()
> 
> "AllocateHugeBlock" allocates 500 blocks each of size 62000 bytes. And
> "FreeHugeBlock" frees the same. These two functions are taking most of
> my execution time. What I want to know is, whether there is any
> workaround for doing the same in a much less time?
> 
> Thanks in advance,
> Regards Sunil

What is that, some 30 MB of mem?  Most likely that memory you want is not being 
set aside in RAM (physical memory) but rather all sorts of effort is being made 
to organize huge amounts of disk as virtual mem, which means the slow time of 
disk I/O as paging is done.  Probably you can ask the system (through the DPMI 
interrupt) for blocks in RAM (memory which you then lock entirely) if you have 
much more RAM, then use that memory.


Mitch Halloran
Research (Bio)chemist
Duzen Laboratories Group
Ankara       TURKEY

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019