Closed Bug 934359 Opened 11 years ago Closed 11 years ago

Encounter 'java.lang.OutOfMemoryError' error when compiling with command 'make -f client.mk'

Categories

(Firefox Build System :: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
mozilla28

People

(Reporter: cewang, Assigned: ckitching)

Details

Attachments

(1 file, 3 obsolete files)

I encountered the following error when compiling gecko with command 'make -f client.mk'

Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
	at java.util.Arrays.copyOf(Arrays.java:2882)
	at java.lang.AbstractStringBuilder.expandCapacity(AbstractStringBuilder.java:100)
	at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:572)
	at java.lang.StringBuilder.append(StringBuilder.java:203)
	at org.mozilla.gecko.annotationProcessors.utils.Utils.writeTypeSignature(Utils.java:248)
	at org.mozilla.gecko.annotationProcessors.utils.Utils.getTypeSignatureString(Utils.java:228)
	at org.mozilla.gecko.annotationProcessors.utils.AlphabeticMethodComparator.compare(AlphabeticMethodComparator.java:23)
	at org.mozilla.gecko.annotationProcessors.utils.AlphabeticMethodComparator.compare(AlphabeticMethodComparator.java:10)
	at java.util.Arrays.mergeSort(Arrays.java:1270)
	at java.util.Arrays.sort(Arrays.java:1210)
	at org.mozilla.gecko.annotationProcessors.utils.GeneratableEntryPointIterator.<init>(GeneratableEntryPointIterator.java:30)
	at org.mozilla.gecko.annotationProcessors.AnnotationProcessor.main(AnnotationProcessor.java:44)

This compile error is caused by the following code segment in 'gecko/build/annotationProcessors/utils/Utils.java'

int len = name.length();
        while (name.endsWith("[]")) {
            sb.append('[');
            name = name.substring(0, len - 2);
        }

The variable 'len' is not assigned the new length(len -2) at the end of the 'while', so when the variable 'name' is a string likes 'boolean[][]',there will be a endless loop.
Whoops!

You appear to be exactly right. He's an patch doing exactly what you said.
Flagging the original reviewer of this code for a rubber-stamp.
Assignee: cewang → chriskitching
Status: NEW → ASSIGNED
Attachment #826645 - Flags: review?(bugmail.mozilla)
Hi, Chris Kitching,could you help me review this patch?
Attachment #826646 - Flags: review?(chriskitching)
Attachment #826646 - Attachment is obsolete: true
Attachment #826646 - Flags: review?(chriskitching)
Attachment #826645 - Attachment is obsolete: true
Attachment #826645 - Flags: review?(bugmail.mozilla)
Comment on attachment 826646 [details] [diff] [review]
Solve endless loop problem in gecko/build/annotationProcessors/utils/Utils.java

Sorry. Beat you to it by a tiny bit there!

Still, your patch looks fine - probably not necessary to include "[PATCH]" at the beginning of the commit message.

It also occurs to me that my patch is actually sort of dumb - an extra function call? that's not sensible. Your approach will perform a little better, as well as being shorter. Let's do it your way.

Just tweak that commit message thing (I think there's sort of strict rules about everything starting with just "Bug XXXXX") and it looks fine to me!
Attachment #826646 - Flags: feedback+
Attachment #826646 - Attachment is obsolete: false
You could also perhaps formulate it as len -= 2?
This seems to have stagnated for a while...

Rubberstamp, please!
Attachment #826646 - Attachment is obsolete: true
Attachment #833355 - Flags: review?(bugmail.mozilla)
Comment on attachment 833355 [details] [diff] [review]
Solve endless loop problem in gecko/build/annotationProcessors/utils/Utils.java

Review of attachment 833355 [details] [diff] [review]:
-----------------------------------------------------------------

Either use cedric's version or move the int to be local inside the loop (or just inline it). I don't like exiting the loop with len !〓 length() even though len isn't used after that. rs〓me with any of those.
Attachment #833355 - Flags: review?(bugmail.mozilla) → review+
(In reply to Kartikaya Gupta (email:kats@mozilla.com) from comment #6)
> Either use cedric's version or move the int to be local inside the loop (or
> just inline it). I don't like exiting the loop with len != length() even
> though len isn't used after that. rs=me with any of those.

Amazing, I uploaded the wrong patch.

Yes, Cedric's approach is clearly far more sane than what I just uploaded. Subtraction! It's subtraction! How did I get subtraction wrong!? :P

Actual rubber-stamp this time, then we can add this to the ever-increasing queue of things to land once the tree opens.
Attachment #833355 - Attachment is obsolete: true
Attachment #833373 - Flags: review?(bugmail.mozilla)
Comment on attachment 826646 [details] [diff] [review]
Solve endless loop problem in gecko/build/annotationProcessors/utils/Utils.java

This one has the right author.
Attachment #826646 - Attachment is obsolete: false
Attachment #826646 - Flags: review+
Attachment #833373 - Attachment is obsolete: true
Attachment #833373 - Flags: review?(bugmail.mozilla)
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/94d56e88f893
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla28
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: