A propos de la fonction stat()

Berruyer (berruyer@AVO.fr)
Fri, 15 May 1998 20:23:45 +0200

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">

[english version is = below the french=20 one] 
 
Bonjour,
 
J'utilise Caml-light = 0.74 sur Windows=20 95, et je voudrais savoir
quelle confiance on = peut accorder au=20 résultat de la fonction stat().
 
La documentation = indique que=20
< (minor_words + = major_words -=20 promoted_words) * 4 > octets
est la quantite de = memoire allouee=20 par le programme.
 
Aussi, j'utilise une = fonction=20 memory() qui me donne tout de suite la memoire allouee :
 
let=20 memory () =3D 
   let s=3Dstat() in 
      let=20 m=3Dfloat_of_int(((s.minor_words)+(s.major_words)-(s.promoted_words))*4) = in 
        =20 begin
          &nbs= p;=20 print_newline();
          &nbs= p;=20 print_string "Mémoire actuellement utilisée par le = programme=20 : "; 
          &nbs= p;=20 print_float (tronque (m/.1024./.1024.)); 
          &nbs= p;=20 print_string " Mo."; 
          &nbs= p;=20 print_newline() 
         = end;; 
 
où la fonction=20 "tronque" tronque un float à la deuxieme = decimale.
 
Cependant, dernierement, cette fonction = m'a affirme=20 que mon programme allouait
879,25 Mo de mémoire. = Evidemment, une telle=20 quantité de mémoire est 
absurde parce que je n'ai pas tant de = place libre=20 sur le dique dur. 
Qu'en est-il ? 
 
Merci d'avance pour vos=20 réponses,
 
Benoît BERRUYER.
 
 
[english = version]
 
Hello,
 
I use Caml-light 0.74 = with Windows=20 95, and i'd like to know to what extent
i can trust in the = results of the=20 stat() fonction.
 
The Caml-doc explains = that=20
< (minor_words + = major_words -=20 promoted_words) * 4 > bytes
is the amount of memory = allocated by=20 the program.
 
So, i use a fonction = memory() that=20 immediately gives me the allocated memory :
 
let=20 memory () =3D 
   let s=3Dstat() in 
      let=20 m=3Dfloat_of_int(((s.minor_words)+(s.major_words)-(s.promoted_words))*4) = in 
        =20 begin
          &nbs= p;=20 print_newline();
          &nbs= p;=20 print_string "Amount of memory currently allocated :=20 "; 
          &nbs= p;=20 print_float (tronque (m/.1024./.1024.)); 
          &nbs= p;=20 print_string " MB."; 
          &nbs= p;=20 print_newline() 
         = end;; 
 
where the fonction=20 "tronque" returns the float with only 2 figures after the=20 point.
 
Yet, lately, this fonction returned = that my program=20 was allocating
879,25 MB of memory. Obviously, such an = amount of=20 memory is 
absurd because there is not so much = free space on=20 my hard disk. 
Then, is there an explaination = ? 
 
Thanks in anticipation for your=20 answers,
 
Benoît = BERRUYER.
          &nbs= p;       =20
------=_NextPart_000_001E_01BD803F.72C12F00--