Support allocations up to 32767 bytes in the pool-based allocator.
The previous limit was 4096 bytes, and trying to allocate more could lead to memory corruption. Raising the limit allows for longer string literals created via concatenation.
This commit is contained in:
parent
a888206111
commit
ba944e5675
10
MM.pas
10
MM.pas
|
@ -168,8 +168,11 @@ var
|
|||
|
||||
begin {GMalloc}
|
||||
if bytes > globalSize then begin {allocate a new pool, if needed}
|
||||
if bytes > poolSize then
|
||||
globalSize := bytes
|
||||
else
|
||||
globalSize := poolSize;
|
||||
myhandle := NewHandle(poolSize, globalID, $C010, nil);
|
||||
myhandle := NewHandle(globalSize, globalID, $C010, nil);
|
||||
if ToolError <> 0 then TermError(5);
|
||||
globalPtr := myhandle^;
|
||||
end; {if}
|
||||
|
@ -209,8 +212,11 @@ var
|
|||
|
||||
begin {LMalloc}
|
||||
if bytes > localSize then begin {allocate a new pool, if needed}
|
||||
if bytes > poolSize then
|
||||
localSize := bytes
|
||||
else
|
||||
localSize := poolSize;
|
||||
myhandle := NewHandle(poolSize, localID, $C010, nil);
|
||||
myhandle := NewHandle(localSize, localID, $C010, nil);
|
||||
if ToolError <> 0 then TermError(5);
|
||||
localPtr := myhandle^;
|
||||
end; {if}
|
||||
|
|
Loading…
Reference in New Issue