What Tom said is true, but there is a deeper reason for immutable
objects as well: For virtual memory, they can be safely stored in a
section of memory that doesn't have to be paged out if the page is
stale in the memory page cache and the virtual machine needs more
real memory. If the page is needed later, the virtual machine is
guaranteed that everything in the page is read-only, so it just
refreshes the page from disk.
Mutable objects are stored in pages that must be written to the disk
if their page gets stale.
Regards,
Jerry
On Oct 8, 2007, at 8:26 AM, Thomas Singer wrote:
Integer, Double and so on all are immutable, so you can safely put
them in a hash map and retrieve them later. If you need mutable
objects for better memory management (you know "don't optimize
before you really have a performance problem"?), you are free to
write your own classes with the methods best suiting your needs.
Cheers,
Tom
Michael Hall wrote:
Not OS X specific. But anyhow, I thought the list was supposed to
allow more general java development discussion these days.
Does anyone have a good explanation for why BigInteger needs to be
immutable? Or know where such a good explanation might be read?
I think sometimes for highly iterative computational code you can
get both better memory management and speed if you avoid the
immutable inherent in BigInteger.
But there might be something I'm missing as to why this isn't a
good idea, so before I put a lot more time into figuring out how
to get around BigInteger?
Mike Hall hallmike at att dot net http://www.geocities.com/mik3hall http://sourceforge.net/projects/macnative
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/java-dev/jerrywwalker%
40gmail.com
This email sent to email@hidden
--
__ Jerry W. Walker,
WebObjects Developer/Instructor for High Performance Industrial
Strength Internet Enabled Systems
email@hidden
203 278-4085 office
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden