[5260] in java-interest
Re: Thanks for replies
daemon@ATHENA.MIT.EDU (Arthur van Hoff)
Sun Feb 4 15:08:06 1996
From: Arthur.Vanhoff@Eng.Sun.COM (Arthur van Hoff)
To: kkobashi@ix13.ix.netcom.com
Date: Sun, 4 Feb 1996 10:21:46 -0800 (PST)
Cc: java-interest@webrunner.neato.org (java)
Hi Kerry,
> - Q: How are the standard data types (float, int, etc) treated in java? As
> instances that exist within the memory pool? System heap?
They are always passed by value. That means that they are not heap
allocated like objects are.
> - Q: Since everything in Java appears to be a class, is it safe to assume that
> the handles (of Java class instances) represent class methods, class
> info and a pointer to the instance within the memory pool?
Right. Internally a handle consists of two pointers: a pointer to the class
and a pointer to the instance on the heap.
> - Q: When are the benefits of using the Integer, Float, Double, etc. classes
> as opposed to the standard types?
These are so called 'wrapper' classes. They let you wrap an instance around
a simple data type. The advantage is that in this way you can use them
with APIs deal only with objects.
> - Q: What determines an instances "marked for deletion bit"?
> Reference count going to zero?
This is done using garbage collection, not reference counting. Reference
counting has the drawback that it doesn't deal well with cyclic data
structures.
The garbage collector first enumerates all reachable handles and
pointers in the virtual machine and marks these objects. Then it scans
the heap for objects that are not marked, these are then garbage because
they are no longer referenced, and their memory can be reused.
Have fun,
Arthur van Hoff
-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com