From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id p61C6o1q032320 for ; Fri, 1 Jul 2011 14:06:50 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AuwBAFG3DU7RVdg2kGdsb2JhbAA8AQMSp1gIFAEBAQEJCQ0HFAQhrF+MJIJLhEA5iGgCAwaGLASHOIp6jB48g1w X-IronPort-AV: E=Sophos;i="4.65,457,1304287200"; d="scan'208";a="86423822" Received: from mail-qw0-f54.google.com ([209.85.216.54]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 01 Jul 2011 14:06:42 +0200 Received: by qwc9 with SMTP id 9so2744895qwc.27 for ; Fri, 01 Jul 2011 05:06:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=zP/SHxdWSfU4FL2Mnw/Twr1OkpEjuQgWvLvLLJ1EeEg=; b=EpKmHONIcuKb8auPeDADudxmnRnhlSd6ZCvgczG8paD1wky6YKvSuMETlZsat7/0on wGK6r6A1aKtnOXEf1X9m+QUn3Vh0r/xr+6vv8YdD/GridOcJ3D1mHs5B3c3YT0dD8Db/ ut1KIKgXo5RVUnptgGwC/uuRnjYYPHH8v/+hg= MIME-Version: 1.0 Received: by 10.229.236.10 with SMTP id ki10mr2411561qcb.274.1309522000892; Fri, 01 Jul 2011 05:06:40 -0700 (PDT) Received: by 10.229.249.206 with HTTP; Fri, 1 Jul 2011 05:06:40 -0700 (PDT) In-Reply-To: <77C1708E-F0E9-4630-BDA5-9B81C51DC5B1@inria.fr> References: <77C1708E-F0E9-4630-BDA5-9B81C51DC5B1@inria.fr> Date: Fri, 1 Jul 2011 16:06:40 +0400 Message-ID: From: Dmitry Bely To: Damien Doligez Cc: Caml List Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by walapai.inria.fr id p61C6o1q032320 Subject: Re: [Caml-list] GC interface question On Fri, Jul 1, 2011 at 3:49 PM, Damien Doligez wrote: > > On 2011-07-01, at 11:09, Dmitry Bely wrote: > >> Does this fragment violate GC interface rules: >> >>  Begin_roots_block(_varg, 2) >>    _varg[0] = ((struct camlidl_intf *) this)->caml_object; >>    _varg[1] = camlidl_alloc_small(1, Abstract_tag); >>    Field(_varg[1], 0) = (value) log; >>  End_roots(); >>  _vres = caml_callbackN_exn(caml_get_public_method(_varg[0], >> Val_int(1007700946)), 2, _varg); >> >> It's unsafe to pass _varg to caml_callbackN_exn when it is not >> referenced from local_roots, right? > > > You're right, this code looks buggy. I tend to think now that this part is OK; _varg is not used after caml_callbackN_exn so local_roots are not needed. But what happens inside caml_callbackN_exn()? How it assures that _varg is not garbage-collected before the closure is applied? This is camlidl-generated code (slightly modified to be thread-safe) and I have an access violation (segmentation fault) error in multi-threaded environment under heavy load. Just trying to figure out what can be wrong here... - Dmitry Bely