« Return to Thread: Using Yap with 3GB of address space on MinGW32 and Cygwin (Win32)

Using Yap with 3GB of address space on MinGW32 and Cygwin (Win32)

by Tony Wilson-3 :: Rate this Message:

Reply to Author | View in Thread


Below are results of tests run with MinGW32 and Cygwin on a XP Home
machine with 2GB user space, and XP Pro (in a virtual machine) with a
3GB user space. My comments:

- When preallocating heap and/or stack, the initial area is contiguous
and there is a limit of 1.598GB on MinGW32 in 2GB or 3GB (It is not
larger on 3GB as the allocation cannot span the 2GB mark). On Cygwin the
limit is 0.834GB on 2GB and 0.974GB on 3GB. This only affects initial
allocation - once it gets going, expansions occur ok.

... all is not lost though as ...

- Without preallocation, Yap uses all memory successfully. However,
Cygwin seems to reserve much more for itself. MinGW allowed 2030016k in
2GB, and 2982367k in 3GB (USERVA set at 3000 - slightly less than
Microsoft suggested max). In Cygwin the maximum was only 1574541k in
2GB, and 2547594k in 3GB. About 400MB less.

- The statistics figures for 'memory total' and 'program space' are
incorrect once an expansion spans a 'hole' (memory that is already
reserved by cygwin/ming/win32). (grep HeapTop Yap_HoleSize in C/*)

MinGW32 is faster and allows more memory. One more nail in Cygwin's coffin.

I had to patch pl/statistics.yap and C/errors.c in order to get useful
(non-negative) figures, but the patches are incomplete and ugly so don't
blame me :) All the 'free' figures can be ignored because of signed
subtraction of negatives and invalid HeapTop-Yap_HoleSize.

Regards,
Tony Wilson
Durban, South Africa



 =============== Preallocating heap

 ===== MinGW on XP Home or Pro/NT without boot.ini changes
 ===== MinGW on XP Pro with /3GB /USERVA=3000 in boot.ini

$ ./yap.exe -h 1598000 -g statistics,halt.
% Restoring file C:\home\t\minYap\startup
YAP version Yap-5.1.4
memory (total)       1598967k bytes
   program space     1598016k bytes:      1094k in use,   1635247160 free
   ...
$ ./yap.exe -h 1599000 -g statistics,halt.
%
%
% YAP OOOPS: likely bug in YAP, segmentation violation.
%

 ===== Cygwin on XP Home or Pro/NT without boot.ini changes

$ ./yap.exe -h 834000 -g statistics,halt.
% Restoring file /home/t/cygYap/startup
YAP version Yap-5.1.4
memory (total)        834999k bytes
   program space      834048k bytes:      1090k in use,    852948016 free
   ...
$ ./yap.exe -h 835000 -g statistics,halt.
%
%
% YAP OOOPS: likely bug in YAP, segmentation violation.
%

 ===== Cygwin on XP Pro with /3GB /USERVA=3000 in boot.ini

$ ./yap.exe -h 973000 -g statistics,halt.
% Restoring file /home/t/cygYap/startup
YAP version Yap-5.1.4
memory (total)        974007k bytes
   program space      973056k bytes:      1090k in use,    995292208 free
   ...
$ ./yap.exe -h 974000 -g statistics,halt.
%
%
% YAP OOOPS: likely bug in YAP, segmentation violation.
%

 =============== Repetitive asserts until failure (no preallocation)

 ===== MinGW on XP Home or Pro/NT without boot.ini changes

 ===== 4800000
memory (total)       2105399k bytes
   program space     2104448k bytes:   1988610k in use,  -4176349608 free
   ...
 ===== 4850000
memory (total)       2121783k bytes
   program space     2120832k bytes:   2009313k in use,  -4180772536 free
   ...
 ===== 4900000
memory (total)       2143287k bytes
   program space     2142336k bytes:   2030016k in use,  -4179952600 free
   ...
2091124KB of Code Space (004A0000--7FEBD000)
4KB of Global Stack (7FEC2000--7FEC33F8)
1KB of Local Stack (7FF8FB9C--7FF90000)
0KB of Trail (7FF90004--7FF90054)

 ===== MinGW on XP Pro with /3GB /USERVA=3000 in boot.ini

 ===== 7100000
memory (total)       3101751k bytes
   program space     3100800k bytes:   2940960k in use,    163675256 free
   ...
 ===== 7150000
memory (total)       3118135k bytes
   program space     3117184k bytes:   2961664k in use,    159252328 free
   ...
 ===== 7200000
memory (total)       3134519k bytes
   program space     3133568k bytes:   2982367k in use,    154829400 free
   ...

3065972KB of Code Space (004A0000--BB6BD000)
4KB of Global Stack (BB6C2000--BB6C33F8)
1KB of Local Stack (BB78FB9C--BB790000)
0KB of Trail (BB790004--BB790054)

 ===== Cygwin on XP Home or Pro/NT without boot.ini changes

 ===== 3700000
memory (total)       2495543k bytes
   program space     2494592k bytes:   1533134k in use,  -3310434784 free
   ...
 ===== 3750000
memory (total)       2532407k bytes
   program space     2531456k bytes:   1553837k in use,  -3293886208 free
   ...
 ===== 3800000
memory (total)       2556983k bytes
   program space     2556032k bytes:   1574541k in use,  -3289920536 free
   ...
2083444KB of Code Space (0xc20000--0x7febd000)
4KB of Global Stack (0x7fec2000--0x7fec33f8)
1KB of Local Stack (0x7ff8fb9c--0x7ff90000)
0KB of Trail (0x7ff90004--0x7ff90054)

 ===== Cygwin on XP Pro with /3GB /USERVA=3000 in boot.ini

 ===== 6050000
memory (total)       3495991k bytes
   program space     3495040k bytes:   2506187k in use,   1012584456 free
   ...
 ===== 6100000
memory (total)       3528759k bytes
   program space     3527808k bytes:   2526891k in use,   1024938744 free
   ...
 ===== 6150000
memory (total)       3545143k bytes
   program space     3544192k bytes:   2547594k in use,   1020515816 free
   ...
3058292KB of Code Space (0xc20000--0xbb6bd000)
4KB of Global Stack (0xbb6c2000--0xbb6c33f8)
1KB of Local Stack (0xbb78fb9c--0xbb790000)
0KB of Trail (0xbb790004--0xbb790054)

 =============== Patches

 ===== C/errors.c line 282

-   fprintf (stderr,"%ldKB of Code Space (%p--%p)\n",(long
int)((CELL)HeapTop-(CELL)Yap_HeapBase)/1024,Yap_HeapBase,HeapTop);
+   fprintf (stderr,"%ldKB of Code Space (%p--%p)\n",(unsigned long
int)((CELL)HeapTop-(CELL)Yap_HeapBase)/1024,Yap_HeapBase,HeapTop);

 ===== pl/statistics.yap

+ makeUnsigned(T,A) :- % if mega display kilo
+    0 =\= T /\ 0xFFF00000, !, K is T >> 10 /\ 0x003FFFFF,
number_atom(K,Ka), atom_concat(Ka,k,A).
+ makeUnsigned(T,T).

 
'$statistics'(Runtime,CPUtime,SYStime,Walltime,HpSpa,HpInUse,HpMax,TrlSpa,
TrlInUse,_TrlMax,StkSpa, GlobInU,
           
LocInU,GlobMax,LocMax,NOfHO,TotHOTime,NOfSO,TotSOTime,NOfTO,TotTOTime,NOfGC,TotGCTime,TotGCSize,
            NOfAGC,TotAGCTime,TotAGCSize) :-
     TotalMemory is HpSpa+StkSpa+TrlSpa,
+    makeUnsigned(TotalMemory,TotalMemoryK),
-+   format(user_error,'memory (total)~t~w bytes~35+~n', [TotalMemoryK]),
+    makeUnsigned(HpSpa,HpSpaK),
-+   format(user_error,'   program space~t~w bytes~35+', [HpSpaK]),
+    makeUnsigned(HpInUse,HpInUseK),
-+   format(user_error,':~t  ~w in use~19+', [HpInUseK]),
        ...


------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Yap-users mailing list
Yap-users@...
https://lists.sourceforge.net/lists/listinfo/yap-users

 « Return to Thread: Using Yap with 3GB of address space on MinGW32 and Cygwin (Win32)