27.04.2013 Views

330 Java Tips.pdf - FTP Server

330 Java Tips.pdf - FTP Server

330 Java Tips.pdf - FTP Server

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Miscellaneous I<br />

as many threads as possible. I figured out this 2G (-mx2047m) limit by trial and error<br />

but is there any way out of this? My workstation happen to have 2G physical<br />

memory, and the file size limit is 2G as well (from ulimit), are there any co-relation<br />

among those numbers?<br />

Answer: Yes, there is a relation: both result from limiting addressing space to what<br />

you can get with signed 32-bit ints for addresses:<br />

2^31 - 1 = 2 * 2^30 -1 = 2 * 1 GB -1 = 2 GB<br />

One of the interesting features of <strong>Java</strong>, is you could run the code with 64 bit<br />

addresses, and nothing would need to change in either the source code or the class<br />

files. The only difference would be you could hold a lot more objects and stack<br />

frames before you blew virtual RAM.<br />

Obviously you would need a different JVM or Hotspot.<br />

<strong>Java</strong> never lets you discover how big references really are inside or how they are<br />

implemented, e.g. as pointers or as handles, or even the granularity of the<br />

addressibility of your machine.<br />

On a 32-bit OS it is a liitle hard to get 32+ bit memory space. How about you try a<br />

64-bit Solaris 8?<br />

answered by Michiel,<br />

Roedy Green, JAVA GLOSSARY see http://www.mindprod.com/jgloss.html<br />

and Johnny Bravo<br />

Q: How can I format a diskette using <strong>Java</strong>? And, what's the way to get the<br />

diskette's size?<br />

Answer: As far as I know: no. Formatting a disk is strongly system dependant, so you<br />

can hardly do this with java.<br />

You *can* however start a new process, have it open a shell or any other kind of<br />

command processor your particular operating system uses, and issue the format<br />

command.<br />

> And, what's the way to get the<br />

> diskette's size?<br />

Again system dependant.<br />

--<br />

Ansgar W. Konermann<br />

Q: I am a 17 year old in the JDK version 1.1 . Is it worth upgrading and getting a<br />

later package, and learning swing?<br />

If so, why?<br />

Answer: Yes.<br />

<strong>Java</strong> 1.3 provides many performance improvements and library additions which will<br />

make your life as a programmer easier.<br />

Swing is "better" than the AWT in that because it is mostly written in <strong>Java</strong> - it has the<br />

advantage of the same look-and-feel across different platforms (which the AWT was<br />

crap at). The reference of the other learned poster to a mainframe is the common<br />

argument that Swing is slow. This _is_ true, however only if you build large<br />

applications and I doubt that at the moment you will.<br />

file:///F|/350_t/350_tips/miscellaneous-I.htm (7 of 11) [2002-02-27 21:18:44]

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!