Date: Mon, 12 Oct 1998 14:16:31 +0200 From: Hans-Bernhard Broeker Message-Id: <199810121216.OAA13359@acp3bf.physik.rwth-aachen.de> To: djgpp AT delorie DOT com Cc: heckler AT mat DOT ufrgs DOT br Subject: Re: Memory allocation Newsgroups: comp.os.msdos.djgpp Organization: RWTH Aachen, III. physikalisches Institut B X-Newsreader: TIN [version 1.2 PL2] Reply-To: djgpp AT delorie DOT com In article <361E6945 DOT 5FCA5FAC AT tecnotron DOT com DOT br> you wrote: > Hi there! the following program allocate lots of memory > and free it. Then, try to allocate again, but with a diferent > block size. It dosn't work ! -> first part runs OK, but the > second gets a "virtual memory exceed" error ! The phenomenon you're observed is called 'heap fragmentation'. By allocating all the available memory in a certain block size, you limit yourself to that particular block size for the rest of your program's lifetime. [...] > I need to allocate lots of memory, in blocks with diferent sizes, > and at diferent times. under some situations, the operations of > "new" and "delete" cause the DPMI server to block the interrupts > for a long time (more than 5ms), and it create problems for a > hardware I drive on the program. I'm not sure such long delays should be happening if you're using a proper DPMI server (i.e. *not* Winblows 9x) and have disabled swapping. > Cloud: it seems for me that I need to reuse the previously > allocated blocks in the same block-size I did first, otherwise > I will receive a "virtual memory exceed in new" ... > ps.: I really don't want to "reinvent the weel", i.e., made > my own memory managing. You may not want to, but your set of requirements blocks all other possibilities, I suspect. -- Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de) Even if all the snow were burnt, ashes would remain.