From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by sympa.inria.fr (Postfix) with ESMTPS id 984A17F1C3 for ; Fri, 23 Nov 2012 07:41:25 +0100 (CET) Received-SPF: None (mail1-smtp-roc.national.inria.fr: no sender authenticity information available from domain of gabriel.scherer@gmail.com) identity=pra; client-ip=209.85.223.182; receiver=mail1-smtp-roc.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="gabriel.scherer@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail1-smtp-roc.national.inria.fr: domain of gabriel.scherer@gmail.com designates 209.85.223.182 as permitted sender) identity=mailfrom; client-ip=209.85.223.182; receiver=mail1-smtp-roc.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="gabriel.scherer@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail1-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-ie0-f182.google.com) identity=helo; client-ip=209.85.223.182; receiver=mail1-smtp-roc.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="postmaster@mail-ie0-f182.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AnoBAGAar1DRVd+2kWdsb2JhbABEwCkIFg4BAQEBCQkNBxIpgh4BAQVAARsdAQMMBgULDS4hAQERAQUBHAYTCIdyAQMPoRKMM4J4hE4KGScNWYh1AQUMi0JphEEDlCyBVYsygzAWKYQR X-IronPort-AV: E=Sophos;i="4.83,306,1352070000"; d="scan'208";a="182803974" Received: from mail-ie0-f182.google.com ([209.85.223.182]) by mail1-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 23 Nov 2012 07:40:58 +0100 Received: by mail-ie0-f182.google.com with SMTP id s9so11216343iec.27 for ; Thu, 22 Nov 2012 22:40:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=3bjKUVip8wxxMvy0QF/Ckw3q0t1OJupoo/Gs09YaSgE=; b=zMYmMyEZ5RsTsbmn/9k49p2NWjRG6NrvuOJliDvaThN6USC5Ks9cGoxLyKn6/BIDrt ZlJ7jXylG1s5Xnek9IfXhweK6cij2YS1/zvmOMSGAUJmsyuEVJpihLHm8HMEWAjG493H sxOlGuptiTSmX84lDRyMw0YVK/65aEE7ub7uGonyAs/HIlfgkSOdkME0hEK6wcmJtz0S 5FukT8SA7sC6DUlk6VxIPwhlM+L/F1kzJqIrfHlyQrMGkZ91MDEpSNHW+5dxxC5+SNhX tkp9gFkRcnXGswViRJ0ndCCRv1OSrO/GOSP4fUMUHEKLgvUJSe9CFrO0YA6eLpEzDSWX TB7w== Received: by 10.43.7.132 with SMTP id oo4mr2420908icb.6.1353652857639; Thu, 22 Nov 2012 22:40:57 -0800 (PST) MIME-Version: 1.0 Received: by 10.50.184.199 with HTTP; Thu, 22 Nov 2012 22:40:17 -0800 (PST) In-Reply-To: References: From: Gabriel Scherer Date: Fri, 23 Nov 2012 07:40:17 +0100 Message-ID: To: Chengqi Song Cc: caml-list@inria.fr Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [Caml-list] Memory usage of ocaml program If you use the C bindings (or a library that does), you may have allocated memory from C, outside the OCaml heap. This memory is not handled by the GC and will not appear in the GC stats. On Fri, Nov 23, 2012 at 3:34 AM, Chengqi Song wrote: > I have the same program (same binary) running in different modes. From > GC stats I see they're using the same amount of heap now (209m) and > the stack is small. But in top's RES column, I see one is using 270m > memory and the other one is using 622m. Forcing heap compaction does > not change the numbers. > > I don't quite understand this difference. A program's memory usage > should be code, static data, heap and stack. For the same binary, code > and static data segment should be the same, and now that GC stats > tells me heap and stack are the same, why there is a 352m difference > in memory usage? > > Thanks