From: sparky4 Date: Mon, 3 Aug 2015 21:21:18 +0000 (-0500) Subject: Signed-off-by: sparky4 X-Git-Url: http://4ch.mooo.com/gitweb/?p=16.git;a=commitdiff_plain;h=591b42161c7fe70f89f8dac6c8afa6e6fb7cb1f8 Signed-off-by: sparky4 --- diff --git a/DEBUG.16 b/DEBUG.16 deleted file mode 100644 index 13e4d4d3..00000000 --- a/DEBUG.16 +++ /dev/null @@ -1,8 +0,0 @@ -0 Size:5194 Owner:0x0 -0 Size:5194 Owner:0x0 -144a Size:256 Owner:0x4d02 -Seg:154a Size:273 Owner:0x859a -Seg:1bd1 Size:17 Owner:0x144d -Seg:1bd1 Size:17 Owner:0x144d -1dd2 Size:49710 Owner:0x11 -Seg:e000 Size:4294909951 Owner:0xc22b diff --git a/HEAP.16 b/HEAP.16 index 96185784..abeb11d5 100644 --- a/HEAP.16 +++ b/HEAP.16 @@ -1,11 +1,10 @@ == default == - USED block at 1bd30016 of size 88 - USED block at 1bd3009e of size 42 - FREE block at 1bd300e0 of size 1f1e - USED block at 1bd31ffe of size 14 - FREE block at 1bd32012 of size 1fea + USED block at 1bda0016 of size 88 + USED block at 1bda009e of size 42 + USED block at 1bda00e0 of size 1f1e + FREE block at 1bda1ffe of size 1ffe OK - end of heap == near == @@ -27,19 +26,18 @@ OK - end of heap USED block at 0 of size 0 USED block at 0 of size 0 USED block at 0 of size 0 - USED block at 0 of size 0 OK - end of heap Memory Type Total Used Free ---------------- -------- -------- -------- -Default 16358 222 16136 -Near 31286 436 30850 -Far 16358 222 16136 +Default 16358 8168 8190 +Near 31286 31286 0 +Far 16358 8168 8190 ---------------- -------- -------- -------- -coreleft = 30848 -farcoreleft = 46788 -GetFreeSize = 15960 -GetNearFreeSize = 30850 -GetFarFreeSize = 15960 -memavl = 30848 -stackavail = 17135 +coreleft = 0 +farcoreleft = 7996 +GetFreeSize = 8014 +GetNearFreeSize = 0 +GetFarFreeSize = 8014 +memavl = 0 +stackavail = 17041 diff --git a/MMDUMP.16 b/MMDUMP.16 deleted file mode 100644 index b14aef4e..00000000 Binary files a/MMDUMP.16 and /dev/null differ diff --git a/exmmtest.exe b/exmmtest.exe index d3de90c1..d0846ef5 100644 Binary files a/exmmtest.exe and b/exmmtest.exe differ diff --git a/fmemtest.exe b/fmemtest.exe index 22b19432..11bcf03c 100644 Binary files a/fmemtest.exe and b/fmemtest.exe differ diff --git a/src/lib/16_hc.c b/src/lib/16_hc.c index af747fc4..a7de12f3 100644 --- a/src/lib/16_hc.c +++ b/src/lib/16_hc.c @@ -25,6 +25,8 @@ #include "src/lib/16_hc.h" +int heaphandle; + void __near* LargestFreeBlock(size_t* Size) { size_t s0, s1; diff --git a/src/lib/16_hc.h b/src/lib/16_hc.h index 7959d295..d9677d10 100644 --- a/src/lib/16_hc.h +++ b/src/lib/16_hc.h @@ -28,7 +28,7 @@ #include "src/lib/16_head.h" -int heaphandle; +extern int heaphandle; void __near* LargestFreeBlock(size_t* Size); size_t _coreleft(void); diff --git a/src/lib/16_mm.c b/src/lib/16_mm.c index bff43730..a784e4fc 100644 --- a/src/lib/16_mm.c +++ b/src/lib/16_mm.c @@ -518,10 +518,10 @@ void MML_UseSpace(/*d*/word segstart, dword seglength, mminfo_t *mm) } //find out how many blocks it spans! - if(seglength>0xffffu) + if((word)seglength>0xffffu) { // segm=seglength/0x4000u; - segm=seglength/0xffffu; + segm=(word)seglength/0xffffu; } else segm=1; @@ -643,6 +643,7 @@ void MM_Startup(mminfo_t *mm, mminfotype *mmi) mm->mmstarted = true; mm->bombonerror = true; + mm->endid=0; // // set up the linked list (everything in the free list; @@ -807,7 +808,8 @@ void MM_GetPtr(memptr *baseptr,dword size, mminfo_t *mm, mminfotype *mmi) { mmblocktype huge *scan,huge *lastscan,huge *endscan,huge *purge,huge *next; int search; - unsigned needed,startseg; + dword needed; + word startseg; needed = (size+15)/16; // convert size from bytes to paragraphs printf("."); //0000 @@ -816,9 +818,9 @@ printf("."); //0000 mm->mmnew->useptr = baseptr; mm->mmnew->attributes = BASEATTRIBUTES; printf("."); //0000 - for(search = 0; search<3; search++) + for(search = 0; searchendid; search++) { -printf("|[case]"); //0000 +printf(" [case]"); //0000 // // first search: try to allocate right after the rover, then on up // second search: search from the head pointer up to the rover @@ -829,19 +831,19 @@ printf("|[case]"); //0000 switch(search) { case 0: -printf("0"); //0000 +printf("0 "); //0000 lastscan = mm->mmrover; scan = mm->mmrover->next; endscan = NULL; break; case 1: -printf("1"); //0000 +printf("1 "); //0000 lastscan = mm->mmhead; scan = mm->mmhead->next; endscan = mm->mmrover; break; case 2: -printf("2"); //0000 +printf("2 "); //0000 MM_SortMem(mm); lastscan = mm->mmhead; scan = mm->mmhead->next; @@ -849,14 +851,14 @@ printf("2"); //0000 break; } - startseg = lastscan->start + lastscan->length; + startseg = lastscan->start + (word)lastscan->length; while(scan != endscan) { -printf(","); //0000 +//printf(","); //0000 if(scan->start - startseg >= needed) { -printf("\\"); //0000 +printf("."); //0000 // // got enough space between the end of lastscan and // the start of scan, so throw out anything in the middle @@ -864,7 +866,7 @@ printf("\\"); //0000 // purge = lastscan->next; lastscan->next = mm->mmnew; - mm->mmnew->start = *(unsigned *)baseptr = startseg; + mm->mmnew->start = *(word *)baseptr = startseg; mm->mmnew->next = scan; while(purge != scan) { // free the purgable block @@ -883,12 +885,13 @@ printf(" freeing block~\n"); //0000 if((scan->attributes & LOCKBIT) || !(scan->attributes & PURGEBITS) ) { -printf("/[lock]"); //0000 +printf(" [lock] "); //0000 +printf("len=%lu ", scan->length); lastscan = scan; - startseg = lastscan->start + lastscan->length; + startseg = lastscan->start + (word)lastscan->length; } - +printf("\n"); scan=scan->next; // look at next line } } @@ -898,6 +901,7 @@ printf("/[lock]"); //0000 heapdump(); printf(OUT_OF_MEM_MSG,(size-mmi->nearheap)); printf("for stability reasons the program will shut down! wwww\n"); + printf(" endid=%u\n",(mm->endid)); MM_Shutdown(mm); exit(-1); } @@ -1566,6 +1570,7 @@ void MM_GetNewBlock(mminfo_t *mm) return; } mm->mmfree=mm->mmfree->next; + mm->endid++; //end of list } void MM_FreeBlock(mmblocktype *x, mminfo_t *mm) @@ -1573,6 +1578,7 @@ void MM_FreeBlock(mmblocktype *x, mminfo_t *mm) x->useptr=NULL; x->next=mm->mmfree; mm->mmfree=x; + mm->endid--; //end of list } void MM_seguin(void) diff --git a/src/lib/16_mm.h b/src/lib/16_mm.h index 010a2626..575685c3 100644 --- a/src/lib/16_mm.h +++ b/src/lib/16_mm.h @@ -136,6 +136,7 @@ typedef struct unsigned totalEMSpages,freeEMSpages,EMSpageframe,EMSpagesmapped,EMShandle; unsigned int EMSVer; word numUMBs,UMBbase[MAXUMBS]; + word endid; //end of list //dword numUMBs,UMBbase[MAXUMBS]; mmblocktype huge mmblocks[MAXBLOCKS],huge *mmhead,huge *mmfree,huge *mmrover,huge *mmnew; } mminfo_t;