From: "Berruyer" <berruyer@AVO.fr>
To: "caml-list" <caml-list@inria.fr>
Subject: A propos de la fonction stat()
Date: Fri, 15 May 1998 20:23:45 +0200
Message en plusieurs parties et au format MIME.
------=_NextPart_000_001E_01BD803F.72C12F00
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
[english version is below the french one]
Bonjour,
J'utilise Caml-light 0.74 sur Windows 95, et je voudrais savoir
quelle confiance on peut accorder au r=E9sultat de la fonction stat().
La documentation indique que=20
< (minor_words + major_words - promoted_words) * 4 > octets
est la quantite de memoire allouee par le programme.
Aussi, j'utilise une fonction memory() qui me donne tout de suite la =
memoire allouee :
let memory () =3D
let s=3Dstat() in
let =
m=3Dfloat_of_int(((s.minor_words)+(s.major_words)-(s.promoted_words))*4) =
in
begin
print_newline();
print_string "M=E9moire actuellement utilis=E9e par le =
programme : ";
print_float (tronque (m/.1024./.1024.));
print_string " Mo.";
print_newline()
end;;
o=F9 la fonction "tronque" tronque un float =E0 la deuxieme decimale.
Cependant, dernierement, cette fonction m'a affirme que mon programme =
allouait
879,25 Mo de m=E9moire. Evidemment, une telle quantit=E9 de m=E9moire =
est
absurde parce que je n'ai pas tant de place libre sur le dique dur.
Qu'en est-il ?
Merci d'avance pour vos r=E9ponses,
Beno=EEt BERRUYER.
[english version]
Hello,
=20
I use Caml-light 0.74 with Windows 95, and i'd like to know to what =
extent
i can trust in the results of the stat() fonction.
=20
The Caml-doc explains that=20
< (minor_words + major_words - promoted_words) * 4 > bytes
is the amount of memory allocated by the program.
=20
So, i use a fonction memory() that immediately gives me the allocated =
memory :
=20
let memory () =3D=20
let s=3Dstat() in=20
let =
m=3Dfloat_of_int(((s.minor_words)+(s.major_words)-(s.promoted_words))*4) =
in=20
begin
print_newline();
print_string "Amount of memory currently allocated : ";=20
print_float (tronque (m/.1024./.1024.));=20
print_string " MB.";=20
print_newline()=20
end;;=20
=20
where the fonction "tronque" returns the float with only 2 figures after =
the point.
=20
Yet, lately, this fonction returned that my program was allocating
879,25 MB of memory. Obviously, such an amount of memory is=20
absurd because there is not so much free space on my hard disk.=20
Then, is there an explaination ?=20
=20
Thanks in anticipation for your answers,
=20
Beno=EEt BERRUYER.
=20
------=_NextPart_000_001E_01BD803F.72C12F00
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML//EN">