From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id q2L9nO3w022007 for ; Wed, 21 Mar 2012 10:49:24 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AicCALSjaU/RVdK2mGdsb2JhbABErgkBiGsIIgEBAQEBCAkNBxQngiICLAEbHgMSEF0BEQEFAU8Ih2gLlxWCXQqME4JxhR4/iHYBBQuQdgSVX45IPYQK X-IronPort-AV: E=Sophos;i="4.73,623,1325458800"; d="scan'208";a="137069788" Received: from mail-iy0-f182.google.com ([209.85.210.182]) by mail4-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 21 Mar 2012 10:49:23 +0100 Received: by iahk25 with SMTP id k25so2284479iah.27 for ; Wed, 21 Mar 2012 02:49:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=q9xOYXidCxTBIHviIkVgHVwYbmHow8pmJt/QHPF3SxE=; b=xg7rEl0jncorexMBcizM4aBBs/4vJ99ZzI/v+gGvRnhSsX39WPDewtfeaZn9qVfEyE +yW3on885qaWLokLCst1fouA7qolKYV0y8+TeeMBrxNWaZLbo1hkxtazW2/0nTFfAtZa YDwXx7uJlLQjmoITC8OrRE4fDu6QdkkaBubPCBPjj6Drnax0ypnotJ8jP+ScwRrcTZOi to+Zw+jHIWChQbi6Omk4WU8JBnOWMGnu/O8qbp/L9JydlN5s5hGx0+2PjsDuBHdlOatF IWPgWP6lvhPRliUrX13oVQcq/6PjUohm63QungZqwNFH2vSRQ4gv8qInKPg2esOVg1Xz Fapw== MIME-Version: 1.0 Received: by 10.50.46.195 with SMTP id x3mr2268558igm.54.1332323362115; Wed, 21 Mar 2012 02:49:22 -0700 (PDT) Received: by 10.42.117.67 with HTTP; Wed, 21 Mar 2012 02:49:22 -0700 (PDT) Date: Wed, 21 Mar 2012 10:49:22 +0100 Message-ID: From: Hans Ole Rafaelsen To: caml-list@inria.fr Content-Type: multipart/alternative; boundary=14dae9340e57b990a704bbbdb40f Subject: [Caml-list] Strategies for finding memory leaks --14dae9340e57b990a704bbbdb40f Content-Type: text/plain; charset=ISO-8859-1 Hello, Is there some tools / tricks that can be used to help find memory leaks? I have trouble with an application, that when running for a long time, starts to use a lot of CPU and consume more memory. It starts out by using about 20% CPU (reported by top) and after 24 hours it has increased to 80% usage. Also physical (RES) memory usage goes from 80M to 160M. The workload for the application is the same the whole time. Using OProfile (http://oprofile.sourceforge.net/news/) shows that that most of the time is being spent doing memory management. At startup: CPU: Core 2, speed 2667 MHz (estimated) Counted CPU_CLK_UNHALTED events (Clock cycles when not halted) with a unit mask of 0x00 (Unhalted core cycles) count 100000 samples % image name symbol name 52764 22.3913 vc_client.native mark_slice 33580 14.2502 vc_client.native caml_page_table_lookup 25415 10.7853 vc_client.native sweep_slice 10119 4.2942 vc_client.native caml_fl_allocate 6423 2.7257 [vdso] (tgid:9015 range:0x7fff4256c000-0x7fff4256d000) [vdso] (tgid:9015 range:0x7fff4256c000-0x7fff4256d000) 5233 2.2207 vc_client.native camlLividisvc__Nalbuf_tools__replace_pattern_1033 2759 1.1708 vc_client.native caml_iterate_global_roots 2728 1.1577 vc_client.native caml_modify 2473 1.0495 vc_client.native caml_oldify_one 2204 0.9353 vc_client.native camlLividisvc__Nalbuf_bytestream__search_1047 2183 0.9264 vc_client.native caml_darken 1935 0.8212 vc_client.native caml_stash_backtrace 1843 0.7821 vc_client.native caml_do_roots 1838 0.7800 vc_client.native caml_delete_global_root After ca. 24 hours run: CPU: Core 2, speed 2667 MHz (estimated) Counted CPU_CLK_UNHALTED events (Clock cycles when not halted) with a unit mask of 0x00 (Unhalted core cycles) count 100000 samples % image name symbol name 1137401 56.2697 vc_client.native mark_slice 405598 20.0658 vc_client.native sweep_slice 399832 19.7806 vc_client.native caml_page_table_lookup 10106 0.5000 vc_client.native caml_fl_allocate 3548 0.1755 vc_client.native caml_iterate_global_roots 3397 0.1681 [vdso] (tgid:26129 range:0x7fff747ff000-0x7fff74800000) [vdso] (tgid:26129 range:0x7fff747ff000-0x7fff74800000) 2797 0.1384 vc_client.native camlLividisvc__Nalbuf_tools__replace_ pattern_1033 2307 0.1141 vc_client.native camlLividisvc__Nalbuf_bytestream__sea rch_1047 2005 0.0992 vc_client.native caml_oldify_local_roots 1786 0.0884 vc_client.native caml_gc_stat 1441 0.0713 vc_client.native caml_oldify_one 1163 0.0575 vc_client.native caml_darken 1163 0.0575 vc_client.native caml_fl_merge_block 1032 0.0511 vc_client.native camlHashtbl__find_1093 The application uses several 3rd party libraries, including: LablGTK2, OCamlNet, LWT and others. Is there some clever trick that can by used to track down or get a hint of what is causing this? Thanks, Hans Ole Rafaelsen --14dae9340e57b990a704bbbdb40f Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hello,

Is there some tools / tricks that can be used to help find me= mory leaks?

I have trouble with an application, that when running fo= r a long time, starts to use a lot of CPU and consume more memory. It start= s out by using about 20% CPU (reported by top) and after 24 hours it has in= creased to 80% usage. Also physical (RES) memory usage goes from 80M to 160= M. The workload for the application is the same the whole time.

Using OProfile (http://oprofile.sourceforge.net/news/) shows that that mos= t of the time is being spent doing memory management.

At startup:
CPU: Core 2, speed 2667 MHz (estimated)
Counted CPU_CLK_UNHALTED events (Clock cycles when not halted) with a unit = mask of 0x00 (Unhalted core cycles) count 100000
samples=A0 %=A0=A0=A0= =A0=A0=A0=A0 image name=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 symbol na= me
52764=A0=A0=A0 22.3913=A0 vc_client.native=A0=A0=A0=A0=A0=A0=A0=A0 ma= rk_slice
33580=A0=A0=A0 14.2502=A0 vc_client.native=A0=A0=A0=A0=A0=A0=A0=A0 caml_pag= e_table_lookup
25415=A0=A0=A0 10.7853=A0 vc_client.native=A0=A0=A0=A0=A0= =A0=A0=A0 sweep_slice
10119=A0=A0=A0=A0 4.2942=A0 vc_client.native=A0=A0= =A0=A0=A0=A0=A0=A0 caml_fl_allocate
6423=A0=A0=A0=A0=A0 2.7257=A0 [vdso]= (tgid:9015 range:0x7fff4256c000-0x7fff4256d000) [vdso] (tgid:9015 range:0x= 7fff4256c000-0x7fff4256d000)
5233=A0=A0=A0=A0=A0 2.2207=A0 vc_client.native=A0=A0=A0=A0=A0=A0=A0=A0 caml= Lividisvc__Nalbuf_tools__replace_pattern_1033
2759=A0=A0=A0=A0=A0 1.1708= =A0 vc_client.native=A0=A0=A0=A0=A0=A0=A0=A0 caml_iterate_global_roots
2= 728=A0=A0=A0=A0=A0 1.1577=A0 vc_client.native=A0=A0=A0=A0=A0=A0=A0=A0 caml_= modify
2473=A0=A0=A0=A0=A0 1.0495=A0 vc_client.native=A0=A0=A0=A0=A0=A0=A0=A0 caml= _oldify_one
2204=A0=A0=A0=A0=A0 0.9353=A0 vc_client.native=A0=A0=A0=A0=A0=A0=A0=A0 = camlLividisvc__Nalbuf_bytestream__search_1047
2183=A0=A0=A0=A0=A0 0.9264=A0 vc_clie= nt.native=A0=A0=A0=A0=A0=A0=A0=A0 caml_darken
1935=A0=A0=A0=A0=A0 0.8212=A0 vc_client.native=A0=A0=A0=A0=A0=A0=A0=A0 caml_stash_back= trace
1843=A0=A0=A0=A0=A0 0.7821=A0 vc_client.native=A0=A0=A0=A0=A0=A0=A0=A0 caml_do_roots1838=A0=A0=A0=A0=A0 0.7800=A0 vc_client.native=A0=A0=A0=A0=A0=A0=A0=A0 caml_delete_g= lobal_root

After ca. 24 hours run:
CPU: Core 2, speed 2667 MHz (estimated)
C= ounted CPU_CLK_UNHALTED events (Clock cycles when not halted) with a unit m= ask
of 0x00 (Unhalted core cycles) count 100000
samples=A0 %=A0=A0=A0=A0=A0= =A0=A0 image name=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 symbol name
= 1137401=A0 56.2697=A0 vc_client.native=A0=A0=A0=A0=A0=A0=A0=A0 mark_slice405598=A0=A0 20.0658=A0 vc_client.native=A0=A0=A0=A0=A0=A0=A0=A0 sweep_sl= ice
399832=A0=A0 19.7806=A0 vc_client.native=A0=A0=A0=A0=A0=A0=A0=A0 caml_page_= table_lookup
10106=A0=A0=A0=A0 0.5000=A0 vc_client.native=A0=A0=A0=A0=A0=A0=A0=A0 caml_fl_allocate<= br>3548=A0=A0=A0=A0=A0 0.1755=A0 vc_client.native=A0=A0=A0=A0=A0=A0=A0=A0 caml_iterate= _global_roots
3397=A0=A0=A0=A0=A0 0.1681=A0 [vdso] (tgid:26129 range:0x7fff747ff000-0x7fff74800000) = [vdso]
=A0(tgid:26129 range:0x7fff747ff000-0x7fff74800000)
2797=A0=A0=A0=A0=A0 0.1384=A0 vc_client.native=A0=A0=A0=A0=A0=A0=A0=A0 camlLividisvc__= Nalbuf_tools__replace_
pattern_1033
2307=A0=A0=A0=A0=A0 0.1141=A0 vc_client.nati= ve=A0=A0=A0=A0=A0=A0=A0=A0 camlLividisvc__Nalbuf_bytestream__sea
rch_1047
2005=A0=A0=A0=A0=A0 0.0992=A0 vc_client.native=A0=A0=A0=A0=A0= =A0=A0=A0 caml_oldify_local_roots
1786=A0=A0=A0=A0=A0 0.0884=A0 vc_client.native=A0=A0=A0=A0=A0=A0=A0=A0 caml= _gc_stat
1441=A0=A0=A0=A0=A0 0.0713=A0 vc_client.native=A0=A0=A0=A0=A0= =A0=A0=A0 caml_oldify_one
1163=A0=A0=A0=A0=A0 0.0575=A0 vc_client.native= =A0=A0=A0=A0=A0=A0=A0=A0 caml_darken
1163=A0=A0=A0=A0=A0 0.0575=A0 vc_cl= ient.native=A0=A0=A0=A0=A0=A0=A0=A0 caml_fl_merge_block
1032=A0=A0=A0=A0=A0 0.0511=A0 vc_client.native=A0=A0=A0=A0=A0=A0=A0=A0 caml= Hashtbl__find_1093

The application uses several 3rd party libraries,= including: LablGTK2, OCamlNet, LWT and others.

Is there some clever= trick that can by used to track down or get a hint of what is causing this= ?

Thanks,

Hans Ole Rafaelsen
--14dae9340e57b990a704bbbdb40f--