Browse Source

* bug allocation of more than 1 MB failed corrected

pierre 27 years ago
parent
commit
69aed4ad5c
2 changed files with 19 additions and 10 deletions
  1. 10 5
      rtl/i386/heap.inc
  2. 9 5
      rtl/m68k/heap.inc

+ 10 - 5
rtl/i386/heap.inc

@@ -944,11 +944,13 @@ begin
    size:=size and $ffff0000;
    size:=size and $ffff0000;
    { Allocate by 64K size }
    { Allocate by 64K size }
    { first try 1Meg }
    { first try 1Meg }
-   NewPos:=Sbrk($100000);
-   if NewPos=-1 then
-     NewPos:=Sbrk(size)
+   if size<$100000 then
+     NewPos:=Sbrk($100000)
    else
    else
-     size:=$100000;
+     NewPos:=SBrk(size);
+   { try again }
+   if NewPos=-1 then
+     NewPos:=Sbrk(size);
    if (NewPos = -1) then
    if (NewPos = -1) then
      begin
      begin
         GrowHeap:=0;
         GrowHeap:=0;
@@ -1062,7 +1064,10 @@ end;
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.14  1998-07-30 13:26:21  michael
+  Revision 1.15  1998-08-24 14:44:04  pierre
+    * bug allocation of more than 1 MB failed corrected
+
+  Revision 1.14  1998/07/30 13:26:21  michael
   + Added support for ErrorProc variable. All internal functions are required
   + Added support for ErrorProc variable. All internal functions are required
     to call HandleError instead of runerror from now on.
     to call HandleError instead of runerror from now on.
     This is necessary for exception support.
     This is necessary for exception support.

+ 9 - 5
rtl/m68k/heap.inc

@@ -949,11 +949,12 @@ begin
    size:=size and $ffff0000;
    size:=size and $ffff0000;
    { Allocate by 64K size }
    { Allocate by 64K size }
    { first try 1Meg }
    { first try 1Meg }
-   NewPos:=Sbrk($100000);
-   if NewPos=-1 then
-     NewPos:=Sbrk(size)
+   if Size<$100000 then
+     NewPos:=Sbrk($100000)
    else
    else
-     size:=$100000;
+     NewPos:=Sbrk(size);
+   if NewPos=-1 then
+     NewPos:=Sbrk(size);
    if (NewPos = -1) then
    if (NewPos = -1) then
      begin
      begin
         GrowHeap:=0;
         GrowHeap:=0;
@@ -1069,7 +1070,10 @@ end;
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.5  1998-08-17 12:27:17  carl
+  Revision 1.6  1998-08-24 14:44:05  pierre
+    * bug allocation of more than 1 MB failed corrected
+
+  Revision 1.5  1998/08/17 12:27:17  carl
     * bugfix of heaperror, was pushing wrong parameter
     * bugfix of heaperror, was pushing wrong parameter
 
 
   Revision 1.4  1998/07/08 11:54:40  carl
   Revision 1.4  1998/07/08 11:54:40  carl