From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: * X-Spam-Status: No, score=1.1 required=5.0 tests=AWL,SPF_NEUTRAL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id CF6B1BC69 for ; Wed, 9 May 2007 12:45:47 +0200 (CEST) Received: from nz-out-0506.google.com (nz-out-0506.google.com [64.233.162.235]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l49AjkV2032095 for ; Wed, 9 May 2007 12:45:47 +0200 Received: by nz-out-0506.google.com with SMTP id l8so158206nzf for ; Wed, 09 May 2007 03:45:45 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=qHU9pVY83CfVrJYpgL/rBv1X2xaZSsC7J3p3BhULsHoAUlJVC9KAoXekeTcs3eVnZplJUeFLkzIeJ+r+WHxz76e6H3QofZSmQOL7LOV700H2vqCJP/whvFoUP+0oS4HQEqBxVV3XgV7UJBogs95ah/dYohNZortET8wh+f1dXS4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=ZzzNGva4jyOxWjtnGbIHAB1X2KhqfDecvQc8+/W2Onv4EjsTLWz1xz5PA/voX2CFHzuwC1VvcsohxSPdQnCWIPz7C97RnwN9WTT3eLB+gcK1AmantOEgYlcuSHBlZkQBc78OuaGllAWQilhM4SzxhNr5vpToAq/xVd/Qrd1cSDs= Received: by 10.114.25.3 with SMTP id 3mr149788way.1178707545445; Wed, 09 May 2007 03:45:45 -0700 (PDT) Received: by 10.114.123.9 with HTTP; Wed, 9 May 2007 03:45:45 -0700 (PDT) Message-ID: <90823c940705090345k5c70fcc3p35ca3cc4412909c2@mail.gmail.com> Date: Wed, 9 May 2007 14:45:45 +0400 From: "Dmitry Bely" To: "Caml List" Subject: Ocaml DLL and memory leaks MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline X-j-chkmail-Score: MSGID : 4641A65A.002 on discorde : j-chkmail score : X : 0/20 1 0.000 -> 1 X-Miltered: at discorde with ID 4641A65A.002 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; ocaml:01 ocaml:01 runtime:01 argv:01 pervasives:01 exn:01 val:01 exn:01 val:01 dynamically:01 dmitry:01 dmitry:01 bely:01 bely:01 caml:02 I have an Ocaml module packed into DLL that is dynamically loaded by the main C program. What should I do to free all memory taken by Ocaml runtime when the DLL is unloaded? The following scenario does not work: [...] case DLL_PROCESS_ATTACH: [...] caml_startup(argv); break; case DLL_PROCESS_DETACH: value* at_exit = caml_named_value("Pervasives.do_at_exit"); if (at_exit != NULL) caml_callback_exn(*at_exit, Val_unit); value* compact = caml_named_value("Gc.compact"); if (compact != NULL) caml_callback_exn(*compact, Val_unit); /* Memory leak! */ Any idea? - Dmitry Bely