From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.6.10/8.6.6) id NAA18692 for caml-redistribution; Tue, 7 Nov 1995 13:48:28 +0100 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.6.10/8.6.6) with ESMTP id NAA18591 for ; Tue, 7 Nov 1995 13:40:26 +0100 Received: from simon.cs.cornell.edu ([128.84.154.10]) by concorde.inria.fr (8.7.1/8.6.9) with SMTP id VAA01757 for ; Mon, 6 Nov 1995 21:26:16 +0100 (MET) Received: from cloyd.cs.cornell.edu (CLOYD.CS.CORNELL.EDU [128.84.227.15]) by simon.cs.cornell.edu (8.6.10/R1.4) with ESMTP id OAA04568 for ; Mon, 6 Nov 1995 14:33:07 -0500 Received: from snotra.cs.cornell.edu (SNOTRA.CS.CORNELL.EDU [128.84.218.5]) by cloyd.cs.cornell.edu (8.6.10/M1.8) with ESMTP id OAA06061 for ; Mon, 6 Nov 1995 14:33:05 -0500 From: Robbert VanRenesse Received: (rvr@localhost) by snotra.cs.cornell.edu (8.6.10/C1.3) id OAA01340 for caml-list@pauillac.inria.fr; Mon, 6 Nov 1995 14:33:02 -0500 Date: Mon, 6 Nov 1995 14:33:02 -0500 Message-Id: <199511061933.OAA01340@snotra.cs.cornell.edu> To: caml-list@pauillac.inria.fr Subject: Final_tag and garbage collection Sender: weis The system that I'm building uses a mixture of C and CAML. Sometimes it is necessary to have references from CAML objects to C objects. When CAML cleans up its objects, the C objects need to be cleaned up as well. I'm using the finalization functionality of CAML for that. However, it only appears to work reliably in combination with alloc_shr(), not with alloc(). Here's the code: value link; link = alloc_shr(3, Final_tag); Field(link, 0) = (value) link_final; ... Very reliably, the function link_final is automatically invoked when the system is garbage collecting. However, if I use alloc() instead, it sometimes happens, but lots of blocks appear to not get finalized. I used all of gc__minor, gc__major, and gc__fullmajor to try to provoke finalization, but only a subset of what I allocated this way gets finalized. Any ideas? Robbert