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

Str memory leak in 3.06? #8119

Closed
vicuna opened this issue Apr 23, 2003 · 0 comments
Closed

Str memory leak in 3.06? #8119

vicuna opened this issue Apr 23, 2003 · 0 comments
Labels

Comments

@vicuna
Copy link

vicuna commented Apr 23, 2003

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

Bug description

This program leaks 10mb/sec on my machine with ocamlopt 3.06 (msvc, xp).

let _ =
while true do
let re = Str.regexp "foo" in ()
done;
()

Inserting a call to Gc.compact in the loop doesn't affect it (well, it
slows the loop down a bit so the leak rate drops :).

From a brief trip in the debugger and a glance at strstubs.cpp it appears
the custom finalizer is being called. I didn't grovel in the actual regex
code to see where the leak was (assuming it's not my bug and I'm supposed
to free the regex somehow in caml code).

I also notice that the strstubs.c has the same problem I reported in
bigarray (and that was fixed, bug #601) about using stat_alloc() to
allocate but free() to deallocate, so it should probably be fixed here as
well, assuming Str is going to live much longer.

Chris

@vicuna vicuna closed this as completed May 5, 2003
@vicuna vicuna added the bug label Mar 19, 2019
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