This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Someone registers thousands of Object's and MethodRef's (was/is: gc times doubling)


Hi,

I'm getting closer - very much closer...

By printf-tracing the GC/libgcj source, I discovered that the increase is due to a "huge" increase in an array and it's marking in "_Jv_MarkArray".
Suddenly the array increases its length from some 21.000 to (approx) eight times the length - namely 170.000.

This must be an older version of libgcj?
Oh I forgot this one: I'm stuck with the 3.4 branch.

What sort of app is this? There isn't usually anything close to 170k methods in any normal app, so something is going wrong here. synchronization/locking (or lack thereof) of the map updating code would be my first suspect.
It turns out my assumption is wrong:
When the array increases to 170k, there is still "only" some 8k methods registered in the array.


Before 170k:
  Methodref count: 8065
After 170k enters:
  Methodref count: 8229

But more interesting is that the amount of "java.lang.Object" instances in the array during the above transition:

Before 170k:
  Object count: 5374
After 170k enters:
  Object count: 155574

Hence, this number increases severely.

So, the problem is no longer the "large" amount of MethodRef instances, but rather the "huge" amount of "java.lang.Object" being marked in "_Jv_MarkArray".

Actually, I reckon now that the problem is visible way way earlier than the huge transition to 170k array.
By scanning the "toString()" output from all the "java.lang.Object" instances in the array (both the 21k and 170k array), I suddenly disover *they all have the same reference*!
The array being marked in "_Jv_MarkArray" contains 5374 (21k) and 155574 (170k), respectively, references to a single "java.lang.Object" instance - at least according to "toString()":


java.lang.Object@10534fd0

So the problem now seems to be: Who is deciding what should be in the array entering "_Jv_MarkArray"?

Not being an expert on GC, nor libgcj, I will risk stating that I expect these many references to the same instance is incorrect?!

Moreover, and maybe of no interest at all, the reference "@10534fd0" is the same everytime I restart the application.

// Martin


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]