[comp.sys.ibm.pc] Microsoft C 5.1 memory fragmentation problem

ddb@ns.network.com (David Dyer-Bennet) (01/02/90)

I'm sure I remember seeing references to this problem in various
places:  when I do a LOT of malloc and free using the library routines
from Microsoft, I get my heap mongo fragmented, because they don't
merge adjacent free space.  (This is obviously a bug, but never mind
that now....)  I vaguely remember that Microsoft has published some
code to do this merging, that one can put into a program and call when
needed.  Can anybody give me a pointer to code to merge adjacent free
space in the Microsoft heap, or code for a whole new malloc that will
work in the Microsoft C environment?  Anon ftp location would be fine,
or mail it to me maybe if it's small.

Thanks!

-- 
David Dyer-Bennet, ddb@terrabit.fidonet.org
or ddb@network.com
or Fidonet 1:282/341.0, (612) 721-8967 9600hst/2400/1200/300
or terrabit!ddb@Lynx.MN.Org, ...{amdahl,hpda}!bungia!viper!terrabit!ddb

dyer@cell.mot.COM (Bill Dyer) (01/09/90)

In article <1990Jan1.211844.10550@ns.network.com> ddb@network.com (David Dyer-Bennet) writes:
>I'm sure I remember seeing references to this problem in various
>places:  when I do a LOT of malloc and free using the library routines
>from Microsoft, I get my heap mongo fragmented, because they don't
>merge adjacent free space.  (This is obviously a bug, but never mind
>that now....)  I vaguely remember that Microsoft has published some
>code to do this merging, that one can put into a program and call when
>needed.  Can anybody give me a pointer to code to merge adjacent free
>space in the Microsoft heap, or code for a whole new malloc that will
>work in the Microsoft C environment?  Anon ftp location would be fine,
>or mail it to me maybe if it's small.
>
>Thanks!

There is a book called Advanced C Tips and Techniques that has a whole chapter
dedicated to the development of a heap manager.  It includes the complete
source listing.  The complete reference is:

Advanced C - Tips and Techniques
Paul Anderson and Gail Anderson
Stephen G. Kochan and Patrick H. Wood eds.
Hayden Books, Indianapolis, Indiana

This is also a great book on C in general.  Hope this helps.