CDCKAB%EMUVM1.BITNET@cunyvm.cuny.edu ( Karl Brendel) (06/05/91)
In article <9106040138.AA07202@lux.sait.edu.au>, et891856@lux.sait.edu.au (Anthony Nuttall) wrote: >I'm in the middle of writing a text windowing unit which uses the >heap to store overlayed parts of the screen and i'm running into >problems with heap overflow. A little investigating with >breakpoints shows the memavail variable staying pretty constant but >the maxavail variable dropping all the time, even though the heap >memory allocated is released later on. > >This kind of points to fragmentation of the heap, my question is : >Is there anyway of defragmenting the heap so my unit doesn't crash ? I'd suggest that you obtain version 6 or a replacement for the heap manager. It may not solve all of your problems--but then again, it might. :) I saw a presentation on the TEGL graphics library's virtual memory manager. I believe it is included in their shareware evaluation package, but not available as a separate product. It might solve this and other problems. I see the C version of TEGL listed at SIMTEL: "PD1:","<MSDOS.C>","TEGLC.ZIP",1,346112,8,901031,"Graphical windowing toolkit demo (TC/MSC)" TEGL Systems Corp can be contacted at Suite 780, 789 West Pender Street, Vancouver, BC, Canada V6C 1H2. Phone +xx 604 669 2577, FAX +xx 604 688 9530. (xx meaning "I dunno".) Standard disclaimers, of course. >"Baldrick, go forth into the streets and announce that Lord > BlackAdder wishes to sell his house. Percy, just go forth into the > streets" >Edmund BlackAdder , "Money", BlackAdder II Drop me some email telling me a bit about BlackAdder, if you would, please. Cheers-- --Karl +====================================================================+ | Karl Brendel Centers for Disease Control | | Internet: CDCKAB@EMUVM1.BITNET Epidemiology Program Office | | Bitnet: CDCKAB@EMUVM1 Atlanta GA 30093 USA | | Home of Epi Info 5.0 | +====================================================================+
hartnegg@sun1.ruf.uni-freiburg.de (Klaus Hartnegg) (06/05/91)
et891856@LUX.SAIT.EDU.AU (et891856) writes: >I'm in the middle of writing a text windowing unit which uses the heap to >store overlayed parts of the screen and i'm running into problems with heap >overflow. A little investigating with breakpoints shows the memavail variable >staying pretty constant but the maxavail variable dropping all the time, even >though the heap memory allocated is released later on. >This kind of points to fragmentation of the heap, my question is : >Is there anyway of defragmenting the heap so my unit doesn't crash ? This can't be done because all pointers would have to be updated but it's impossible to find them all. If you know all your variables you can perhaps do it yourself but that's complicated. Try allocating memory in larger blocks, for example multiples of 16 bytes. You can even cause Turbo-Pascal to do this automatically It's described somewhere in the manual. I think it can be done by replacing the getmem and freemem procedures. Klaus -- -------------------------------------------------------------------------- Klaus Hartnegg, Kleist-Str. 7, D-7835 Teningen, Germany | include standard Bitnet : hartnegg@dfrruf1 or hartnegg@cernvm | disclaimer here! Internet : hartnegg@ibm.ruf.uni-freiburg.de |