caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Chris Hecker <checker@d6.com>
To: caml-list@inria.fr, caml-bugs@pauillac.inria.fr
Subject: [Caml-list] Str memory leak in 3.06?
Date: Thu, 24 Apr 2003 00:41:14 -0700	[thread overview]
Message-ID: <4.3.2.7.2.20030424001900.037a2958@localhost> (raw)


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

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


             reply	other threads:[~2003-04-24  7:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-04-24  7:41 Chris Hecker [this message]
2003-04-24 13:09 ` Xavier Leroy
2003-04-24 23:21   ` Chris Hecker

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=4.3.2.7.2.20030424001900.037a2958@localhost \
    --to=checker@d6.com \
    --cc=caml-bugs@pauillac.inria.fr \
    --cc=caml-list@inria.fr \
    /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).