caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* A propos de la fonction stat()
@ 1998-05-15 18:23 Berruyer
  1998-05-18  8:51 ` Francois Rouaix
  0 siblings, 1 reply; 2+ messages in thread
From: Berruyer @ 1998-05-15 18:23 UTC (permalink / raw)
  To: caml-list

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2291 bytes --]

[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.
                  





^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: A propos de la fonction stat()
  1998-05-15 18:23 A propos de la fonction stat() Berruyer
@ 1998-05-18  8:51 ` Francois Rouaix
  0 siblings, 0 replies; 2+ messages in thread
From: Francois Rouaix @ 1998-05-18  8:51 UTC (permalink / raw)
  To: Berruyer; +Cc: caml-list


> La documentation indique que  < (minor_words + major_words - 
> promoted_words) * 4 > octets est la quantite de memoire allouee par 
> le programme. 

Il s'agit de la memoire totale allouee, et non de la memoire "actuellement"
allouee. Le GC est passe par la, et a libere puis reutilise une partie de
cette memoire.
Pour avoir une idee de l'utilisation courante de la memoire, il vaut mieux
utiliser
wordsize * st.heap_words   : taille du heap en octets
(float st.live_words) /. (float st.heap_words) : pourcentage de ce qui est
vraiment utilise dans le heap (le reste etant disponible pour allocation).

Damien me corrigera si je dis des betises.

--f




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1998-05-18 13:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-05-15 18:23 A propos de la fonction stat() Berruyer
1998-05-18  8:51 ` Francois Rouaix

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).