Version française
Home     About     Download     Resources     Contact us    
Browse thread
A propos de la fonction stat()
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Berruyer <berruyer@A...>
Subject: A propos de la fonction stat()
[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ésultat de la fonction stat().

La documentation indique que
< (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 () =
   let s=stat() in
      let =
m=float_of_int(((s.minor_words)+(s.major_words)-(s.promoted_words))*4) =
in
         begin
            print_newline();
            print_string "Mémoire actuellement utilisée par le =
programme : ";
            print_float (tronque (m/.1024./.1024.));
            print_string " Mo.";
            print_newline()
         end;;

où la fonction "tronque" tronque un float à la deuxieme decimale.

Cependant, dernierement, cette fonction m'a affirme que mon programme =
allouait
879,25 Mo de mémoire. Evidemment, une telle quantité de mémoire =
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éponses,

Beno=EEt BERRUYER.


[english version]

Hello,

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.

The Caml-doc explains that
< (minor_words + major_words - promoted_words) * 4 > bytes
is the amount of memory allocated by the program.

So, i use a fonction memory() that immediately gives me the allocated =
memory :

let memory () =
   let s=stat() in
      let =
m=float_of_int(((s.minor_words)+(s.major_words)-(s.promoted_words))*4) =
in
         begin
            print_newline();
            print_string "Amount of memory currently allocated : ";
            print_float (tronque (m/.1024./.1024.));
            print_string " MB.";
            print_newline()
         end;;

where the fonction "tronque" returns the float with only 2 figures after =
the point.

Yet, lately, this fonction returned that my program was allocating
879,25 MB of memory. Obviously, such an amount of memory is
absurd because there is not so much free space on my hard disk.
Then, is there an explaination ?

Thanks in anticipation for your answers,

Beno=EEt BERRUYER.