Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!gatech!gitpyr!roy From: roy@gitpyr.gatech.EDU (Roy Mongiovi) Newsgroups: comp.sys.ibm.pc Subject: Re: Fragmentation on DOS - HELP ! Message-ID: <3617@gitpyr.gatech.EDU> Date: Wed, 20-May-87 20:02:14 EDT Article-I.D.: gitpyr.3617 Posted: Wed May 20 20:02:14 1987 Date-Received: Sat, 23-May-87 08:44:02 EDT References: <287@pyuxv.UUCP> <764@usfvax2.UUCP> Organization: Georgia Institute of Technology, Atlanta Lines: 22 Summary: DOS frees all memory when a process terminates. In article <764@usfvax2.UUCP>, chips@usfvax2.UUCP (Chip Salzenberg) writes: > DOS does not reclaim these little blocks automatically. Only the block that > contains the program's Program Segment Prefix (PSP) is automatically freed on > exit. (Good thing, too, since to free your own code could be hazardous.) This isn't at all true. Each block of memory allocated via the DOS functions has a 16 byte (1 paragraph) header which contains, among other things, the PSP of its owner. When a program terminates by any function except one of the terminate and stay resident functions, all memory blocks owned by its PSP are freed. I don't understand the last quoted sentence. How exactly could freeing the code segment for the program that just terminated be hazardous? That seems to me to be exactly what ought to happen.... I sincerely hope that MSC does not use the DOS functions directly to allocate memory, since 16 bytes is a tremendous overhead for small blocks. I don't own Microsoft C, so someone else will have to look into it. -- Roy J. Mongiovi Systems Analyst Office of Computing Services Georgia Institute of Technology Atlanta GA 30332. (404) 894-4660 ...!{akgua, allegra, amd, hplabs, ihnp4, masscomp, ut-ngp}!gatech!gitpyr!roy