caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Anders Fugmann <anders@fugmann.net>
To: Kenneth Adam Miller <kennethadammiller@gmail.com>,
	 caml users <caml-list@inria.fr>
Subject: Re: [Caml-list] Potential OCaml-ZMQ memory management problems
Date: Thu, 04 Dec 2014 08:55:31 +0100	[thread overview]
Message-ID: <54801373.3010506@fugmann.net> (raw)
In-Reply-To: <CAK7rcp9iRMQo0H1DRo00QRM5bw6psT2kN+pkkcjip9ykrLtL-A@mail.gmail.com>

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.


  reply	other threads:[~2014-12-04  7:55 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-04  6:09 Kenneth Adam Miller
2014-12-04  7:55 ` Anders Fugmann [this message]
2014-12-04  8:02   ` Kenneth Adam Miller
2014-12-04  9:59     ` Anders Fugmann
2014-12-04 10:04       ` Kenneth Adam Miller
2014-12-04 16:39         ` Kenneth Adam Miller
2014-12-04 16:45           ` Kenneth Adam Miller
2014-12-04 19:36             ` Anders Peter Fugmann
2014-12-04 21:48               ` Kenneth Adam Miller
2014-12-05  9:14                 ` Anders Fugmann
2014-12-05 14:38                   ` Kenneth Adam Miller
2014-12-08 18:11                     ` Kenneth Adam Miller
2014-12-08 18:16                       ` Yotam Barnoy
2014-12-08 18:19                         ` Kenneth Adam Miller

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=54801373.3010506@fugmann.net \
    --to=anders@fugmann.net \
    --cc=caml-list@inria.fr \
    --cc=kennethadammiller@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).