Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Re: How do I find all references to an object in the JVM?

Reply
Thread Tools

Re: How do I find all references to an object in the JVM?

 
 
Harald Hein
Guest
Posts: n/a
 
      11-15-2003
"GoogleMan" wrote:

> QUESTION:
> How can you find ALL references to a particular object instance,
> or even ALL references to a particular class, in the JVM?


You can't from inside the JVM.

> I guess I can traverse the remaining objects, searching for the
> removed object reference but I'm not confident that all of the
> removed object references will be found since I can only make
> assumptions based upon reflection info.


Anyway it will not work. The class loader will keep the class.

> I'm not interested in debating why I need the reference list,


Well, it is your problem. But the idea of telling people on usenet what
they are supposed to discuss, and what not is rather hilarious. It
might work in your military environment, but not here.

> I just need a mechanism to get a
> reference list for a particular object, or class.


You need a severe redesign of your application. But ups, we are not
supposed to discuss this.

 
Reply With Quote
 
 
 
 
GoogleMan
Guest
Posts: n/a
 
      11-16-2003
Harald Hein <> wrote in message news:<Xns94345AFD748A5hhtoken@194.97.5.9>...

Let me start by thanking you, Harald, for taking the time to read my
post and responding and I do appreciate it, but...

> "GoogleMan" wrote:
>
> > QUESTION:
> > How can you find ALL references to a particular object instance,
> > or even ALL references to a particular class, in the JVM?

>
> You can't from inside the JVM.


Why? Is there no mechanism whatsoever to get these references from
within the Java API? I know you can get the JVM internals at runtime
using the JVMPI C API, but that isn't useful in a cross-platform
distribution.

Since you can traverse the stack when an exception is thrown (using
the Exception) it seems that there is some sort of reference structure
in the JVM exposed to the Java API. Maybe the JVM acts as a factory
and kicks this out, making it a one-way (JVM to Java Object) street.

It would be helpful as to why you can't than just saying that you
can't.

> > I guess I can traverse the remaining objects, searching for the
> > removed object reference but I'm not confident that all of the
> > removed object references will be found since I can only make
> > assumptions based upon reflection info.

>
> Anyway it will not work. The class loader will keep the class.


If so, how does garbage collection work then? I'm don't care about
the class, but the actual object instance so I don't see from your
response how the class loader will retain object instance references.

> > I'm not interested in debating why I need the reference list,

>
> Well, it is your problem. But the idea of telling people on usenet what
> they are supposed to discuss, and what not is rather hilarious. It
> might work in your military environment, but not here.


I never told anyone what they can or cannot discuss on Usenet, I did
mention that I, personally, wasn't interested in discussing the need
for a redesign or not, but I just wanted to address the technical
question posed. Call me crazy, but that is the reason why I posted
and, I thought, one of the reasons people subscribe to the technical
groups on Usenet.

I guess you don't believe someone can voice a personal perspective in
their own posting. Hmmm, are you sure YOU aren't in a military
(irrational left and right-wing orbits count) environment?

"...but not here." What? I'm so glad that you're keeping the Usenet
safe for personal expression... yeah, right... see my point above...

I spent hours searching Usenet on this topic, and many other topics
over the last decade, and many times the underlying technical question
is never answered due to a spiraling into semantic and design peeves.

The reason why I put the caveat of not wanting to debate the design is
that if you search Usenet for an answer to a particular technical
question, many times you'll get multiple posts as to 'why' you
wouldn't want to do it that way and not solutions.

So instead of getting anywhere, or even answering the original
questions, you get some convoluted debate on design, including
attempts by the poster to give sufficient background of the
application to defend the architecture.

>
> > I just need a mechanism to get a
> > reference list for a particular object, or class.

>
> You need a severe redesign of your application. But ups, we are not
> supposed to discuss this.


and here you go... or at least, here you would have went... or maybe
that would have been the extent of your response...

Sometime the re-design argument holds water and helps solve the
underlying issues of the original poster (and others), but I already
know there is no way to "redesign" the application due to its nature
and function.

The reason why I gave some background on the application is to give a
competent technical person (and I would count you as one) an overview
of the framework mechanims so the focus would remain on the technical
question posed.

A mechanism of getting these references to object instances in the JVM
seems to be much requested, but all posts on this topic are, just as
your post, belittling of this approach and spiral into a debate about
redesign.

And, a one line, "you need to redesign your application" is a bit
cliche. It's all over Usenet and, just as your line, is oh-so-helpful
in solving the technical issues raised.

----

I don't want to get into a flame war here. I, and many professionals,
yourself included I would think, use the Usenet for a technical
knowledge repository. It's just frustrating when you can't find a
answer (not just this one) for technical questions posed dozens upon
dozens of times.

Anyway, no worries.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Replace all references to one object with references to other Jack Bates Python 3 08-06-2011 12:57 AM
Difference between bin and obj directories and difference between project references and dll references jakk ASP .Net 4 03-22-2005 09:23 PM
Re: How do I find all references to an object in the JVM? John C. Bollinger Java 5 11-19-2003 02:06 PM
Re: How do I find all references to an object in the JVM? Chris Uppal Java 2 11-17-2003 02:48 PM
Pointers and References (and References to Pointers) Roger Leigh C++ 8 11-17-2003 10:14 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57