caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Kecheng" <kecheng@cecs.pdx.edu>
To: "caml-list" <caml-list@yquem.inria.fr>
Subject: OCaml memory leak issue
Date: Tue, 23 Nov 2010 19:54:24 -0800	[thread overview]
Message-ID: <201011231954241577004@cecs.pdx.edu> (raw)

[-- Attachment #1: Type: text/plain, Size: 2134 bytes --]

Hi,

I used valgrind to check the memory usage of my OCaml byte code, but I found that a memory leak. I'm very confused what the problem is. I tried a very simple code as following, and compileed it. 

+++++++++++++++++++++++
let test  = 
    let a = 1 in
    let b = a + 5 in
    printf "%d\n" b;
;;
test;;
+++++++++++++++++++++++

And I run valgrind to check: 

valgrind --leak-check=yes ./obj/x86_LINUX/test5.byte.exe 

I got the following report:
==21692== Memcheck, a memory error detector
==21692== Copyright (C) 2002-2009, and GNU GPL'd, by Julian Seward et al.
==21692== Using Valgrind-3.5.0 and LibVEX; rerun with -h for copyright info
==21692== Command: ./obj/x86_LINUX/test5.byte.exe
==21692==
6
==21692==
==21692== HEAP SUMMARY:
==21692==     in use at exit: 430,488 bytes in 20 blocks
==21692==   total heap usage: 68 allocs, 48 frees, 446,837 bytes allocated
==21692==
==21692== 120 bytes in 1 blocks are definitely lost in loss record 9 of 17
==21692==    at 0x4A05E1C: malloc (vg_replace_malloc.c:195)
==21692==    by 0x9AA510: caml_init_major_heap (in /home/kecheng/symbolic_simulation/cvc_test/cvc_1.5/obj/x86_LINUX/test5.byte.exe)
==21692==    by 0x9A2A1A: caml_init_gc (in /home/kecheng/symbolic_simulation/cvc_test/cvc_1.5/obj/x86_LINUX/test5.byte.exe)
==21692==    by 0x997E9D: caml_main (in /home/kecheng/symbolic_simulation/cvc_test/cvc_1.5/obj/x86_LINUX/test5.byte.exe)
==21692==    by 0x9981CB: main (in /home/kecheng/symbolic_simulation/cvc_test/cvc_1.5/obj/x86_LINUX/test5.byte.exe)
==21692==
==21692== LEAK SUMMARY:
==21692==    definitely lost: 120 bytes in 1 blocks
==21692==    indirectly lost: 0 bytes in 0 blocks
==21692==      possibly lost: 0 bytes in 0 blocks
==21692==    still reachable: 430,368 bytes in 19 blocks
==21692==         suppressed: 0 bytes in 0 blocks
==21692== Reachable blocks (those to which a pointer was found) are not shown.
==21692== To see them, rerun with: --leak-check=full --show-reachable=yes
==21692==
==21692== For counts of detected and suppressed errors, rerun with: -v
==21692== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 4 from 4)




Kecheng
2010-11-23

[-- Attachment #2: Type: text/html, Size: 5103 bytes --]

             reply	other threads:[~2010-11-24  3:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-24  3:54 Kecheng [this message]
2010-11-24  4:06 ` [Caml-list] " Edgar Friendly
2010-11-24  7:30 ` Török Edwin
2010-11-24 22:40   ` Goswin von Brederlow
2010-11-24 23:41     ` DS
2010-11-25 13:27       ` Goswin von Brederlow
2010-11-25  7:42     ` Christophe TROESTLER

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=201011231954241577004@cecs.pdx.edu \
    --to=kecheng@cecs.pdx.edu \
    --cc=caml-list@yquem.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).