Return-Path: Delivered-To: apmail-tomcat-users-archive@www.apache.org Received: (qmail 58848 invoked from network); 27 Jan 2010 15:57:00 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 27 Jan 2010 15:57:00 -0000 Received: (qmail 93363 invoked by uid 500); 27 Jan 2010 15:56:56 -0000 Delivered-To: apmail-tomcat-users-archive@tomcat.apache.org Received: (qmail 93296 invoked by uid 500); 27 Jan 2010 15:56:56 -0000 Mailing-List: contact users-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Users List" Delivered-To: mailing list users@tomcat.apache.org Received: (qmail 93285 invoked by uid 99); 27 Jan 2010 15:56:56 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 27 Jan 2010 15:56:56 +0000 X-ASF-Spam-Status: No, hits=1.2 required=10.0 tests=SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [76.96.59.243] (HELO qmta13.westchester.pa.mail.comcast.net) (76.96.59.243) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 27 Jan 2010 15:56:46 +0000 Received: from omta07.westchester.pa.mail.comcast.net ([76.96.62.59]) by qmta13.westchester.pa.mail.comcast.net with comcast id afUA1d0081GhbT85DfwSDd; Wed, 27 Jan 2010 15:56:26 +0000 Received: from [192.168.1.202] ([98.218.200.175]) by omta07.westchester.pa.mail.comcast.net with comcast id afwR1d00R3nZbXm3TfwS2x; Wed, 27 Jan 2010 15:56:26 +0000 Message-ID: <4B606228.4080708@christopherschultz.net> Date: Wed, 27 Jan 2010 10:56:24 -0500 From: Christopher Schultz User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1.7) Gecko/20100111 Thunderbird/3.0.1 MIME-Version: 1.0 To: Tomcat Users List Subject: Re: tomcat memory usage References: <626831.11349.qm@web54404.mail.re2.yahoo.com> <309552.52635.qm@web54410.mail.re2.yahoo.com> In-Reply-To: <309552.52635.qm@web54410.mail.re2.yahoo.com> X-Enigmail-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hüsnü, On 1/27/2010 2:06 AM, Hüsnü Þentürk wrote: > As far as I know, heap memory is used by objects. On the other hand, > our application has static variables and references to the objects > residing in heap area. Does it mean, static variables and references > of our application are stored outside of reserved 512MB area? Or, the > memory outside of 512MB reserved heap area used only by Java itself? No. All Java objects and their associated data are stored within the heap. Unless you are writing JNI code, then everything you are effecting is happening in the heap. Static variables and references (which are the same thing, depending on how you see things) are not special in any way when it comes to memory use. It's the JVM itself which is allocating memory outside that heap. Memory, for instance, to help manage the heap itself. And all the threads you've got running. And the garbage collector. Basically: total memory = heap memory + non-heap memory Using JVM options, you can really only effect the heap memory size, the PermGen space, and the size of thread stacks. Basically, there is going to be some extra memory needed for non-heap stuff. Especially on Windows, I've seen reports of non-heap memory piling up quite a bit. Something else to note: Windows' Task Manager is a terrible tool for memory profiling, even without regard to Java's GC/heap issues. WTM just shows you a single number for "memory" and doesn't explain anything. Many DLLs loaded into a process's memory space are, in fact, shared with many other processes. For instance, win32.dll (or whatever it's called these days) gets mapped-into practically every process that runs under Microsoft Windows. The memory used by that DLL is proably counted against that process in WTM, when a lot of it is really being shared by all processes. Yes, there is a lot of process-private (and thread-private) data, but the fact that WTM shows you only a single number for "memory" means that you're not getting the whole story. Hmm... I'm looking at SysInternals (yes, they've been bought but I pine for Mark Russinovich's freedom) Process Explorer and it looks like WTM might be giving you the "private working set" which is essentially the memory that only that process is using. For instance, WTM reports that firefox.exe right now is using ~575MiB. (The column explicitly says "private working set" if I expand it enough). Process Explorer reports: Virtual Memory Private Bytes: ~ 762MiB Peak Private Bytes: ~ 880MiB Virtual Size: ~1108MiB Physical Memory: Working Set: ~ 599MiB WS Private: ~ 575MiB WS Shareable: ~ 23MiB WS Shared: ~ 10MiB Peak Working Set: ~ 835MiB WTM has gotten a lot better since the last time I checked: you can choose which columns to view and it has an array of memory-related data you can display. So, maybe WTM is giving you a decent measure of what memory is actually being used by that process, specifically. Anyhow, you have to realize that virtual machines are complex beasts and that there's more going on that your own code running inside that VM. Other than the surprising realization that a 512MiB heap yields a 600MiB process, is there a particular problem with the difference, here? - -chris -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAktgYigACgkQ9CaO5/Lv0PAE4gCfe02Wp9q7LonyBl4a4b0+OyOP AFcAnjxPJ0djagrgBSWAlrETrsHhEkWJ =M6aj -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org For additional commands, e-mail: users-help@tomcat.apache.org