Message-Id: <199909161257.PAA07940@ankara.Foo.COM> From: "S. M. Halloran" 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 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT 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 Precedence: bulk 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