MLton RAM usage
Anoq of the Sun
anoq@HardcoreProcessing.com
Tue, 18 Sep 2001 12:35:01 +0200
This is a multi-part message in MIME format.
--------------790B14F1A8F04952AD9A855B
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Stephen Weeks wrote:
> Strange indeed. We should figure this out. Since you only have 512M RAM, my
> first guess is that the sysinfo call in gc.c is not returning a reasonable
> result and that the gc is therefore confused as to how much RAM you have. If it
> thinks you have 1G, it will certainly try to use it for a self compile. To
> test, this, could you please run a make with the FLAGS line in
> src/mlton/Makefile as follows.
>
> FLAGS = @MLton max-heap 450m -- -v -o $(AOUT)
This helped! And now it compiles in minutes rather than hours :)
> This will restrict mlton to using 450m and will bypass what is returned by
> sysinfo. If that compile succeeds, we need to investigate getRAMsize in gc.c.
> Hopefully you can write a little C file to see what getRAMsize is returning.
I wrote the attached C-file testGetMem.c and the output I'm getting
by just running it is:
449523712
Which I think looks OK. And by the way - when the compilation
failed, it was on the original source distribution - long before I
added the Win32 #defines - so that shouldn't be why it gives correct
output now.
But now that I'm trying to compile again, it only uses about 430 MB -
even after removing the "max-heap 450m" flags! So it seems to work now.
But maybe it's because I did a "make install" with the flags set so
that it's still floating around somewhere on my machine where I
just can't find it...
I have also attached some results of cat /proc/meminfo:
memInfoNormal.txt is the normal output
memInfoCompiling.txt is what I got during compilation
(when it used 430 MB)
And my system is Debian Linux, kernel 2.2 (I think it's 2.2.17 -
but I'm not sure).
Cheers
--
http://www.HardcoreProcessing.com
--------------790B14F1A8F04952AD9A855B
Content-Type: application/x-unknown-content-type-ProjectBuilder.c;
name="testGetMem.c"
Content-Transfer-Encoding: base64
Content-Disposition: inline;
filename="testGetMem.c"
I2luY2x1ZGUgIm1sdG9uLTIwMDEwODA2X1RvV2luMzJPcmlnL3NyYy9ydW50aW1lL215LWxpYi5o
IgojaW5jbHVkZSA8c3RkaW8uaD4KCiNpZiBkZWZpbmVkKF9XSU4zMikKI2luY2x1ZGUgPHdpbmRv
d3MuaD4KI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bmxpbmUgdWludApnZXRSQU1zaXplKHZvaWQpICAKewojaWYgZGVmaW5lZChfV0lOMzIp
CiAgICAgICAgTUVNT1JZU1RBVFVTIG1TdGF0dXM7CiAgICAgICAgdWludCBuOwogICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgR2xvYmFsTWVtb3J5U3RhdHVzKCZtU3RhdHVz
KTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgbiA9IG1TdGF0dXMuZHdUb3RhbFZpcnR1YWw7
ICAKICAgICAgICAvLyBXZSBjb3VsZCBhbHNvIHVzZSBtU3RhdHVzLmR3VG90YWxQaHlzOwogICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICByZXR1cm4gcm91bmRQYWdlKCh1aW50KSgo
ZG91YmxlKW4gKiBSQU1TTE9QKSk7CiNlbHNlCiAgICAgICAgc3RydWN0IHN5c2luZm8gIHNidWY7
CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgIAogICAgICAgIHVubGVzcyAoc3lzaW5mbygmc2J1ZikgPT0gMCkKICAg
ICAgICAgIHB1dHMoInN5c2luZm8gZmFpbGVkIik7ICAgCiAgICAgICAgcmV0dXJuIChyb3VuZFBh
Z2Uoc2J1Zi50b3RhbHJhbSAqIFJBTVNMT1ApKTsKI2VuZGlmCn0KCmludCBtYWluKCkKewogIHBy
aW50ZigiJWxkXG4iLCAobG9uZylnZXRSQU1zaXplKCkpOwogIAp9ICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICA=
--------------790B14F1A8F04952AD9A855B
Content-Type: text/plain; charset=us-ascii;
name="memInfoNormal.txt"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="memInfoNormal.txt"
total: used: free: shared: buffers: cached:
Mem: 528846848 201199616 327647232 23728128 137613312 30453760
Swap: 0 0 0
MemTotal: 516452 kB
MemFree: 319968 kB
MemShared: 23172 kB
Buffers: 134388 kB
Cached: 29740 kB
SwapTotal: 0 kB
SwapFree: 0 kB
--------------790B14F1A8F04952AD9A855B
Content-Type: text/plain; charset=us-ascii;
name="memInfoCompiling.txt"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="memInfoCompiling.txt"
total: used: free: shared: buffers: cached:
Mem: 528846848 526430208 2416640 33677312 22163456 27037696
Swap: 0 0 0
MemTotal: 516452 kB
MemFree: 2360 kB
MemShared: 32888 kB
Buffers: 21644 kB
Cached: 26404 kB
SwapTotal: 0 kB
SwapFree: 0 kB
--------------790B14F1A8F04952AD9A855B--