public inbox for java@gcc.gnu.org
 help / color / mirror / Atom feed
From: Andrew Haley <aph@redhat.com>
To: java@gcc.gnu.org
Subject: Re: GC leaks debugging
Date: Mon, 04 Apr 2011 09:48:00 -0000	[thread overview]
Message-ID: <4D9993D4.9040704@redhat.com> (raw)
In-Reply-To: <BANLkTin=jtQV9T94ikC4Ju1EpDExH4LdUw@mail.gmail.com>

On 04/04/2011 09:52 AM, Erik Groeneveld wrote:
> On Mon, Apr 4, 2011 at 10:13 AM, Andrew Haley <aph@redhat.com> wrote:
>> On 03/04/11 18:59, Erik Groeneveld wrote:
>>> On Sun, Apr 3, 2011 at 7:14 PM, Erik Groeneveld <erik@cq2.nl> wrote:
>>>> On Sat, Apr 2, 2011 at 11:38 AM, Erik Groeneveld <erik@cq2.nl> wrote:
>>>>>
>>>>>> Note that in the information you posted, the GC was scanning around 7.5MB of roots conservatively.  It might be worth checking what those regions are.
>>> [...]
>>>> So I am now off into JvCreateJavaVM,
>>>
>>> and I found that the 7.5 MB roots are the static data area of libgcj
>>> itself.  The GC calls back -- the last arg being the size:
>>>
>>> _Jv_GC_has_static_roots(../gccinstall/lib/libgcj.so.12, 0xb704f000, 7544028)
>>>
>>> and since libgcj is in 'the store' (_Jv_print_gc_store() prints
>>> "../gccinstall/lib/libgcj.so.12"), it tells the GC to scan its static
>>> data area conservatively.
>>>
>>> As of yet I don't understand why this static area is so big, and what
>>> could be on it, but when I lay myself to rest, the little gray cells
>>> will sing to me (free after Hercules Poirot ;-).
>>
>> It'll mostly be introspection data.  Every class and every method has
>> this, and it can get to be quite large.
> 
> I saw the (old) patch of yours that moves static Java objects onto the
> heap, avoiding it to be scanned conservatively, so I couldn't think of
> anything else to be on the static data area of libgcj than Java
> pointers to the objects heap.  Now I see that there is still a lot
> more data that must be scanned conservatively, so couldn't there be
> similar problems as back then?  Couldn't it be an idea to try to move
> this introspection data to the heap as well?

It's certainly possible, but you can't move all of it with our current
design because it doesn't play nicely with CNI.  Therefore, a lot of
libgcj is compiled with static introspection data that must be
conservatively scanned.

>> I doubt it's the cause of
>> your memory leak unless there's a bug elsewhere.
> 
> Probably there is no clear bug, or clear leak, perhaps just a matter
> of pushing the GC to the limits? 

I doubt that very much.  This has come up several times in the past,
and the problem has never been the garbage collector recognizing false
positives.  It's almost certainly a real memory leak caused by a
pointer somewhere not being nulled.

> Some code is running quite well for long times, other isn't.  I all
> cases, the heap grows very fast, with lots of black listing
> messages, and sometimes the GC just seems to manage, sometimes it
> doesn't and things explode while issuing the famous "need to
> allocate large block etc" repeatedly.  From what Hans suggested and
> from what I see in the logs, the GC is under very heavy stress,
> right from the beginning.  It doesn't get a fair chance so to say.

I don't think so.

> My minimal program is now this:
> 
> int main(int argc, char *argv[]) {
>     _Jv_InitGC();
> }
> 
> It starts out with:
> 
> roots: 7,072 kB
> heap: 64 kB
> free: 64 kB
> blacklisted: 15/16
> blacklist messages: 991
> 
> Any real program produces so much blacklist messages that it hardly
> runs.  I'd like to investigate this or am I on the wrong track
> completely?

I think you are.  The heap is small in this simple test case, so there
are no real problems.

You need to find out what the real problem is.  Find just one of those
"need to allocate large block" messages, and find out why it is being
called.  I suspect that there is an actual bug that is causing the
explosion and it can be found.  Forget about 991 blacklist messages:
not useful.

I'd have a look myself, but there is no way to duplicate your problem.

BTW, is this on a 32-bit or 64-bit platform?

Andrew.

  reply	other threads:[~2011-04-04  9:48 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-01  8:39 Erik Groeneveld
2011-04-01  8:45 ` Andrew Haley
2011-04-01  9:03   ` Erik Groeneveld
2011-04-01  9:34     ` Andrew Haley
2011-04-02  0:27       ` Boehm, Hans
2011-04-02  9:39         ` Erik Groeneveld
2011-04-03 17:15           ` Erik Groeneveld
2011-04-03 18:00             ` Erik Groeneveld
2011-04-04  8:13               ` Andrew Haley
2011-04-04  8:53                 ` Erik Groeneveld
2011-04-04  9:48                   ` Andrew Haley [this message]
2011-04-05  4:44                     ` Boehm, Hans
2011-04-05  8:58                       ` Andrew Haley
2011-04-05  6:50                     ` Erik Groeneveld
2011-04-05  9:02                       ` Andrew Haley
2011-04-05 12:02                         ` Erik Groeneveld
2011-04-05 12:55                           ` Andrew Haley
2011-04-06 14:30                             ` Erik Groeneveld
2011-04-06 18:33                               ` Andrew Haley
2011-04-06 18:39                                 ` David Daney
2011-04-07 17:43                                 ` Erik Groeneveld
2011-04-08  8:12                                   ` Erik Groeneveld
2011-04-08 13:56                                   ` Andrew Haley
2011-04-08 15:35                                     ` David Daney
2011-04-08 15:53                                       ` Erik Groeneveld
2011-04-08 15:57                                         ` Andrew Haley
2011-04-08 15:48                                     ` Erik Groeneveld
2011-04-09  1:17                                     ` Boehm, Hans
2011-04-09  8:47                                       ` Andrew Haley
2011-04-09 10:56                                       ` Erik Groeneveld
2011-04-10 11:03                                         ` Erik Groeneveld
2011-04-12 18:43                                           ` Erik Groeneveld
2011-04-13  8:11                                             ` Andrew Haley
2011-04-13 12:11                                               ` Bryce McKinlay
2011-04-13 14:27                                                 ` Andrew Haley
2011-04-14  8:36                                               ` Erik Groeneveld
2011-04-14  8:43                                                 ` Andrew Haley
2011-04-14 10:02                                                   ` Erik Groeneveld
2011-04-14 10:50                                                     ` Andrew Haley
2011-04-15  7:32                                                       ` Erik J Groeneveld
2011-04-01 17:41 ` David Daney
2011-04-02 16:21   ` Erik Groeneveld

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=4D9993D4.9040704@redhat.com \
    --to=aph@redhat.com \
    --cc=java@gcc.gnu.org \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).