Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

memory leak #3530

Closed
vicuna opened this issue Mar 11, 2005 · 1 comment
Closed

memory leak #3530

vicuna opened this issue Mar 11, 2005 · 1 comment
Labels

Comments

@vicuna
Copy link

vicuna commented Mar 11, 2005

Original bug ID: 3530
Reporter: administrator
Status: closed
Resolution: fixed
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)

Bug description

Full_Name: Lodewijk Voge
Version: any, up and including 3.08 CVS as of an hour ago
OS: Linux (i386/amd64), FreeBSD (i386), MacOS X
Submission from: 69.25.77.51 (69.25.77.51)

I'm experiencing a memory leak in a long running process that seems to have to
do with the C interface. noone on the mailinglist could point to the obvious
fault, so I'm submitting it as a bug. the cut-down version that behaves the same
is this ocaml code:

external bar: unit -> Unix.inet_addr * unit = "bar"

let _ =
let s = String.create 392 in
while true do
ignore(bar ());
done

with this C code:

#include <caml/alloc.h>
#include <caml/mlvalues.h>
#include <caml/misc.h>
#include <caml/memory.h>

CAMLprim value bar(value unit) {
CAMLparam1(unit);
CAMLlocal2(res, addr);
int i;

    addr = alloc_string(4);
    *(int *)(String_val(addr)) = htonl(0xac100000);
    res = alloc_tuple(2);
    Store_field(res, 0, addr);
    Store_field(res, 1, Val_unit);
    CAMLreturn(res);

}

which will result in a slowly but steadily growing process. if you change bar's
type and implementation to only return the Unix.inet_addr, it shows no such
growth.

thanks,
Lodewijk

@vicuna
Copy link
Author

vicuna commented Mar 11, 2005

Comment author: administrator

already fixed (see #3531)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant