Bug 563960 - Requested length of new long[2,147,483,640] exceeds limit of 2,147,483,639
Summary: Requested length of new long[2,147,483,640] exceeds limit of 2,147,483,639
Status: RESOLVED FIXED
Alias: None
Product: MAT
Classification: Tools
Component: Core (show other bugs)
Version: 1.10   Edit
Hardware: PC Windows All
: P3 blocker (vote)
Target Milestone: 1.11.0   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 473113
  Show dependency tree
 
Reported: 2020-06-04 17:58 EDT by venkata bhagavatula CLA
Modified: 2020-10-18 03:11 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description venkata bhagavatula CLA 2020-06-04 17:58:48 EDT
Trying to open a 218GB Heap file. I get the error message 

Requested length of new long[2,147,483,640] exceeds limit of 2,147,483,639

I have tried checking keep unreachable objects in preferences but it fails. 

Any help is appreciated. Let me know what I can do to help.
Comment 1 Andrew Johnson CLA 2020-06-05 03:27:31 EDT
I'm sorry, but you have exceeded the architectural limit of the number of objects which Memory Analyzer can handle.
Memory Analyzer uses signed ints for object IDs and Java arrays indexed by an int to hold information about objects.
Rewriting MAT to use longs and multidimensional arrays or other data structures would be a big job, and no one has 
the full time job of maintaining and enhancing MAT.

https://help.eclipse.org/2020-03/topic/org.eclipse.mat.ui.help/tasks/configure_mat.html?cp=59_3_16

There has been discussion in bug 473113 here:
https://www.eclipse.org/lists/mat-dev/msg00573.html
https://www.eclipse.org/lists/mat-dev/msg00324.html
https://www.eclipse.org/lists/mat-dev/msg00325.html
https://www.eclipse.org/lists/mat-dev/msg00326.html

Do you have any idea as to how many objects are actually in your heap dump, or of what types
(primitive arrays, Strings, other Java objects) ?

Do you have some ideas of what we could do without a full rewrite?
Comment 2 venkata bhagavatula CLA 2020-06-05 12:41:37 EDT
The heap dump is from a third party MDM product. Sorry, I don't have an idea of how many objects it has in memory. I am trying to open it up visualvm, if I succeed, I will update you with the count.
Comment 3 Andrew Johnson CLA 2020-06-05 13:31:04 EDT
I've got an idea which is implementable but may be of limited use. What do you think of this?

I can modify the HPROF parser to randomly discard a percentage of objects of certain types.
If we discarded some Strings and char[] then that wouldn't break the object graph as they are leaves, but might reduce
the object count enough to load the dump. I can then count those objects in the unreachable object histogram.
Comment 4 Eclipse Genie CLA 2020-06-06 09:16:19 EDT
New Gerrit change created: https://git.eclipse.org/r/164333
Comment 6 Andrew Johnson CLA 2020-06-06 10:00:26 EDT
I've delivered some changes which might help, available as a snapshot build: https://www.eclipse.org/mat/snapshotBuilds.php

There are now some HPROF options to discard objects in the initial parse. 

Try
Window > Preferences > Memory Analyzer > HPROF Parser
Enable discard
Discard precentage: 80
Discard object type pattern: char\[\]|java\.lang\.String

That should discard 80% of the Strings and char[] arrays, perhaps bringing the total number of objects to less than 2,147,483,640.

The discarded objects will be counted in the Unreachable Objects histogram,
together with any objects found to be unreachable in the MAT garbage collection clean process (if keep_unreachable_objects
is not set).

With luck the discarded objects won't stop you finding the leak, although any leak might look smaller.
Other objects might still have dangling references to the discarded objects - which might cause problems for some queries.

Please let me know how you get on, so we can see if this idea is useful or not, and how to make it work best.
Comment 7 Eclipse Genie CLA 2020-06-09 15:12:14 EDT
New Gerrit change created: https://git.eclipse.org/r/164568
Comment 9 Eclipse Genie CLA 2020-06-10 14:05:52 EDT
New Gerrit change created: https://git.eclipse.org/r/164659
Comment 11 Andrew Johnson CLA 2020-06-10 15:40:50 EDT
I've made the changes including adding some help.
Please could you test a snapshot build from https://www.eclipse.org/mat/snapshotBuilds.php and see if it helps you
analyze your dump.
Thanks.
Comment 12 Eclipse Genie CLA 2020-06-11 08:28:32 EDT
New Gerrit change created: https://git.eclipse.org/r/164700
Comment 14 Andrew Johnson CLA 2020-06-16 07:06:02 EDT
I'm marking this as fixed. I hope the work-around is suitable. If you see any problems with the work-around
or things are unclear in the help or preferences then please reopen this defect.

If you really need more than 2,147,483,639 objects in a snapshot then please open a new bug. I think though it wouldn't
get fixed unless many users hit the problem and that there was a developer with sufficient time to work on the problem.
Comment 15 venkata bhagavatula CLA 2020-06-17 11:35:35 EDT
I have instance count from jproiler, the number is 2656093430.
Comment 16 venkata bhagavatula CLA 2020-06-17 11:37:44 EDT
Sorry, I didn't receive notifications for you messages. I will test and keep you posted.
Comment 17 Eclipse Genie CLA 2020-10-18 03:09:31 EDT
New Gerrit change created: https://git.eclipse.org/r/c/mat/org.eclipse.mat/+/170904