From: Xavier Leroy <Xavier.Leroy@inria.fr>
To: Maltey UPS <Francois.Maltey@enst-bretagne.fr>, caml-list@inria.fr
Subject: Re: garbage collector / lien avec le C et librairie strlib
Date: Fri, 13 Nov 1998 10:48:09 +0100 [thread overview]
Message-ID: <19981113104809.21627@pauillac.inria.fr> (raw)
In-Reply-To: <199811130534.GAA16498@audrey.enst-bretagne.fr>; from Maltey UPS on Fri, Nov 13, 1998 at 06:34:15AM +0100
[ English summary: finalized blocks allow the Caml garbage collector
to free data allocated with malloc in C libraries.]
> J'ai l'impression que le programme regex.c (qui crée des automates
> de reconnaissance d'expressions régulières) fait des "malloc".
> Je ne sais pas si (ni comment comprendre) caml "récupère" la mémoire
> lors d'un "garbage collector" lorsque, après avoir créé une expression
> réguliere (avec str__regexp) le programme ne l'utilise plus et elle
> n'est plus accessible.
Il s'agit d'un trait malheureusement non documenté du GC de Caml Light
et Objective Caml: certains blocs du tas Caml peuvent porter une
fonction de "finalisation" qui est appelée lorsque le GC libère le
bloc Caml en question.
Typiquement, str__regexp alloue un tel bloc et stocke dedans le
pointeur vers la structure allouée par malloc() renvoyée par la
bibliothèque regex.c. La fonction de finalisation fait alors
l'équivalent de free() sur le pointeur C contenu dans le bloc
finalisé.
On peut ainsi coupler le GC automatique de Caml avec une discipline de
déallocation explicite telle que suivie par la plupart des
bibliothèques C.
Pour plus d'infos: http://caml.inria.fr/caml-list-ar/0345.html
Cordialement,
- Xavier Leroy
prev parent reply other threads:[~1998-11-13 11:22 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
1998-11-13 5:34 Maltey UPS
1998-11-13 9:48 ` Xavier Leroy [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=19981113104809.21627@pauillac.inria.fr \
--to=xavier.leroy@inria.fr \
--cc=Francois.Maltey@enst-bretagne.fr \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox