Short: AllocP - BetterAlloc (AllocMem/AllocVec patch) V1.3 Author: Andreas_Kleinert@t-online.de Uploader: Andreas_Kleinert@t-online.de Type: util/sys Sometimes programs fail with a "not enough memory" error, but after calling "avail flush" the same operation does succeed without problems. Obviously AllocMem/AllocVec does not force such a "flush" operation *and* tries to allocate memory again. Why ? This patch does ensure, that AllocMem/AllocVec won't fail unless there's really no memory available, even by flushing. This means: - less "out of memory" failures - less "bad behaviour" of bad programs, which don't check results of AllocMem/AllocVec - no more need to call "avail flush" by hand from the shell - thus no more "retry" operations after "avail flush" - no more unused libraries/devices consuming memory when it is already low Additionally, it makes AllocVec aligning its allocations to longword boundaries - at the *end* . As you know, the Alloc#? functions always return memory starting at longword-aligned boundaries. But since Exec just keeps a list of the free memory and not the allocated memory, this could mean, that the number of 1, 2 or 3 byte chunks (which would never be used again unless their predecessors or successors are delocated again) could increase drastically. There's no way to bypass this for AllocMem, but for AllocVec the requested allocation now automatically will include these "gaps", with the following side effects: - less entries in the free memory list - less memory fragmentation - less administration overhead - a little bit more safety with programs, which usually overwrite AllocVec'ed buffers by 1, 2 or 3 bytes and otherwise might have produced MungWall hits ;-) - the latter may also be true for some cases where programs don't align their Read/WritePixeLine8() buffers ;-) Note: Needs V37+ and 68020. To be put into s:user-startup, but runable anywhere else, too. You use this patch at your own risk. No guarantee for anything. Source code included. --- All mentioned trademarks are subject to their owners. ============================= Archive contents ============================= Original Packed Ratio Date Time Name -------- ------- ----- --------- -------- ------------- 835 390 53.2% 01-Aug-97 10:07:56 +AllocP.info 162 100 38.2% 01-Aug-97 09:51:40 +smakefile 2204 1106 49.8% 16-Aug-97 09:06:34 +AllocP.readme 141 115 18.4% 16-Aug-97 09:12:24 +SCOPTIONS 3712 2255 39.2% 24-Aug-97 11:58:26 +AllocP 7448 1665 77.6% 24-Aug-97 11:58:14 +AllocP.c 1348 824 38.8% 24-Aug-97 11:58:24 +AllocP.o -------- ------- ----- --------- -------- 15850 6455 59.2% 29-Aug-97 19:43:14 7 files