From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id 87E947FB13 for ; Thu, 4 Dec 2014 08:55:34 +0100 (CET) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of anders@fugmann.net) identity=pra; client-ip=90.184.182.235; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="anders@fugmann.net"; x-sender="anders@fugmann.net"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of anders@fugmann.net designates 90.184.182.235 as permitted sender) identity=mailfrom; client-ip=90.184.182.235; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="anders@fugmann.net"; x-sender="anders@fugmann.net"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@fw.fugmann.net) identity=helo; client-ip=90.184.182.235; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="anders@fugmann.net"; x-sender="postmaster@fw.fugmann.net"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Aq4EAG8SgFRauLbr/2dsb2JhbABag1iDXcNMhhoCgSsBAQEBAX2EAwEBBCMVQBELGAICBRYLAgIJAwIBAgFFBgEMCAKIPgm/RpZbAQEIAQEBAQEZBIErjASDPoJxgVEBBJQmjVCMe4N6gzMBAQE X-IPAS-Result: Aq4EAG8SgFRauLbr/2dsb2JhbABag1iDXcNMhhoCgSsBAQEBAX2EAwEBBCMVQBELGAICBRYLAgIJAwIBAgFFBgEMCAKIPgm/RpZbAQEIAQEBAQEZBIErjASDPoJxgVEBBJQmjVCMe4N6gzMBAQE X-IronPort-AV: E=Sophos;i="5.07,514,1413237600"; d="scan'208";a="111003010" Received: from 0405ds1-vaer.1.fullrate.dk (HELO fw.fugmann.net) ([90.184.182.235]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/ADH-AES256-SHA; 04 Dec 2014 08:55:33 +0100 Received: from [10.0.10.23] (issuu [195.184.103.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by fw.fugmann.net (Postfix) with ESMTPSA id B2684169184E; Thu, 4 Dec 2014 08:55:31 +0100 (CET) Message-ID: <54801373.3010506@fugmann.net> Date: Thu, 04 Dec 2014 08:55:31 +0100 From: Anders Fugmann User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.0 MIME-Version: 1.0 To: Kenneth Adam Miller , caml users References: In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Validation-by: anders@fugmann.net Subject: Re: [Caml-list] Potential OCaml-ZMQ memory management problems Hi Kenneth, The Ocaml-zmq code copies data from received messages into memory under the control of the ocaml garbage collector, and immediatly frees the ZMQ buffers. You do not need to explicitly free the data received from call to recv. Can you produce a small sample code that exposes the problem? We are using the ocaml-zmq binding extensively, and have not seen any problems. If I were to take a wild guess, it either a mismatch between library versions or the garbage-collector collecting the socket or zmq context. What version of the ocaml-zmq bindings and libzmq (c impl) are you using? /Anders On 12/04/2014 07:09 AM, Kenneth Adam Miller wrote: > I'm using ocaml-zmq (https://github.com/issuu/ocaml-zmq) and I think I'm > encountering a memory management issue. I could be wrong however, but > basically the issue (I think) is I have a rather large set of messages > to send via zmq, and I'm getting a segfault. > > Does anybody know if I need to free the strings received from zmq recv > functions in ocaml? If so how do I do that from ocaml? > > There's no code because this is just a general novice ocaml questions.