Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OQL in Eclipse memory analyzer - how to display array / ArrayList contents

Tags:

java

eclipse

oql

I have a dump which I opened with Eclipse Memory Analyzer.

I would like to export some contents of the heap into a file.

One of the fields I'm interested in is an ArrayList and I could not find a way to query the dump in a way that will return the contents of the array list as an output:

  • Selecting the ArrayList object itself returns something like: java.util.ArrayList [id=0xf2765680]

  • Selecting the array within the array list (select arr.elementData...) returns something like: java.lang.Object[] [id=0xf2765698;length=4]

  • Selecting toString(arr) or toString(arr.elementData) returns empty string when the arrayList isn't null (and the string null when it is).

Is it really impossible??

like image 899
Dikla Avatar asked Aug 02 '14 21:08

Dikla


1 Answers

To get list of elements

SELECT OBJECTS arr.@referenceArray FROM OBJECTS <your_array_address> arr

To re-map list of elements of array

SELECT OBJECTS elem.<field_name> FROM OBJECTS (SELECT OBJECTS arr.@referenceArray FROM OBJECTS <your_array_address> arr) elem

Real example

SELECT OBJECTS elem.callable.task.task FROM OBJECTS (SELECT OBJECTS arr.@referenceArray FROM OBJECTS 0x645eb6b80 arr) elem
like image 194
Ievgen Avatar answered Sep 22 '22 01:09

Ievgen