From 0d4edf118e0fc68e7ecff79c71dfc80dda38c213 Mon Sep 17 00:00:00 2001 From: nickysn Date: Wed, 25 Jun 2014 09:33:04 +0000 Subject: [PATCH] + added upper limits to the heapmin and heapmax values set by the $M directive git-svn-id: trunk@28056 - --- compiler/scandir.pas | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/compiler/scandir.pas b/compiler/scandir.pas index 4732ba9c05..3062453b10 100644 --- a/compiler/scandir.pas +++ b/compiler/scandir.pas @@ -703,7 +703,27 @@ unit scandir; procedure dir_memory; var l : longint; + heapsize_limit: longint; + maxheapsize_limit: longint; begin +{$if defined(i8086)} + if current_settings.x86memorymodel in x86_far_data_models then + begin + heapsize_limit:=655360; + maxheapsize_limit:=655360; + end + else + begin + heapsize_limit:=65520; + maxheapsize_limit:=65520; + end; +{$elseif defined(cpu16bitaddr)} + heapsize_limit:=65520; + maxheapsize_limit:=65520; +{$else} + heapsize_limit:=high(heapsize); + maxheapsize_limit:=high(maxheapsize); +{$endif} current_scanner.skipspace; l:=current_scanner.readval; if (l>=1024) @@ -723,14 +743,14 @@ unit scandir; current_scanner.skipspace; l:=current_scanner.readval; if l>=1024 then - heapsize:=l; + heapsize:=min(l,heapsize_limit); if c=',' then begin current_scanner.readchar; current_scanner.skipspace; l:=current_scanner.readval; if l>=heapsize then - maxheapsize:=l + maxheapsize:=min(l,maxheapsize_limit) else Message(scan_w_heapmax_lessthan_heapmin); end;