Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Memory Analyzer (MAT) » Finding (ascii) strings in byte[] data
Finding (ascii) strings in byte[] data [message #8186] Sat, 13 December 2008 11:15 Go to next message
Taras Tielkes is currently offline Taras TielkesFriend
Messages: 38
Registered: July 2009
Member
Hi,

Is there a way to search for specific strings in byte[] objects, similar
to the existing feature for Strings?

-tt
Re: Finding (ascii) strings in byte[] data [message #8218 is a reply to message #8186] Sun, 14 December 2008 16:14 Go to previous messageGo to next message
Taras Tielkes is currently offline Taras TielkesFriend
Messages: 38
Registered: July 2009
Member
In addition to searching byte[] instances (presumably by specifying a
character endoding), I want to search char[] instance as well.

-tt
Re: Finding (ascii) strings in byte[] data [message #8249 is a reply to message #8218] Mon, 15 December 2008 09:57 Go to previous messageGo to next message
Andreas Buchen is currently offline Andreas BuchenFriend
Messages: 123
Registered: July 2009
Senior Member
Hi Taras,

a simple (but maybe too simple) way is this:

SELECT * FROM byte[] b WHERE toString(b) LIKE ".*java.lang.Object.*"

The "toString" function converts the object into a string representation.
It is used, among other things, in the object list or the inspector view.
However, this prints only the first 1000 characters and therefore the
regular expression works only on the first 1000 characters.


Otherwise you'd need to code a query for this. Let me think if we can make
the "find strings" query a little more generic.


Andreas.
Re: Finding (ascii) strings in byte[] data [message #8475 is a reply to message #8249] Tue, 16 December 2008 20:32 Go to previous message
Taras Tielkes is currently offline Taras TielkesFriend
Messages: 38
Registered: July 2009
Member
Hi Andreas,

One use case for searching in byte[]/char[] in addition to Strings is this:

I have a snapshot of a servlet container serving a number of concurrent
threads at the moment the snapshot was taken. Now I want to search for
some attributes of a particular request. For example: full URL or remote
IP address.

I'm pretty sure that this data is available in some internal data
structures of (in this case) Catalina - in fact it is. However, since
those structures are relatively close to the "network stack", a lot of
the data is in form of byte[]/char[].

In other cases I don't actually know for sure if some data can be found
in the snapshot. However, I just want to search with a net as wide as
possible.

In the ideal situation I'd specify a search pattern, and then
enable/disable some checkboxes (or similar) to indicate what kind of
"character-like" objects I want to target. I'm not sure what the best UI
would be.

That aside, being able to search through all String/byte[]/char[] in one
sweep would be a very powerful feature.

Just thinking...are there any more potential character data objects that
could be potential targets for such an expanded pattern search?

-tt
Previous Topic:Strange OOM error when running MAT + DTFJ on *some* jextract'ed zips
Next Topic:MAT not showing entire HEAP ?
Goto Forum:
  


Current Time: Fri Apr 19 04:06:23 GMT 2024

Powered by FUDForum. Page generated in 0.03521 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top