 |
 |
Index ‹ java-programmer
|
- Previous
- 7
- major version 49?It looks like the JRE classes that come with the 1.5.0 beta have their
major version set to 49. Does anyone know of any documentation
available for this new version of the class file format? It appears
that the signatures can now have "+" prepended to them, which I am
assuming has something to do with generics. I have no idea what other
changes may be in there.
- 7
- Recursion / Iteration (was Re: Increasing the stack?)Hi !
"bm" wrote the following:
> All recursions can be rewritten as iterations. Though it may not be as
> elegant.
> But not all iterations can be written as recursion.
I always thougt, it was just the other way round, but I might well be wrong
! Can you show one example for your last statement (an iteration that cannot
be expressed as a recursion) ?
- 7
- Trap and write out error to fileI am using the following borrowed code to run unix commands.
Occasionally it returns 3, apparently without actually running the
command and I do not know why.
I would like to get more info on the error and write it to a file.
As I am not a java programmer can someone help me amend the code to
write the error details of the t object to a file?
Thanks in advance.
Runtime rt = Runtime.getRuntime();
Process p = rt.exec(Command);
try {
rc = p.waitFor();
} catch (InterruptedException intexc) { rc = 2; }
rt.gc();
} catch (Throwable t) { rc = 3; }
- 7
- Who specifies Java? We know that Java is specified by Sun Microsystems, Inc.
On the other hand, a language is specified by its specification
and in the case of Java this is the JLS. The specification is
specified or written by its authors. The authors of the JLS are:
http://images.pearsoned-ema.com/jpeg/large/0321246780.jpg
James Gosling, Bill Joy, Guy Steele, and Gilad Bracha.
So then, is Java being specified by James Gosling, Bill Joy,
Guy Steele, and Gilad Bracha or by Sun Microsystems, Inc.?
- 7
- inner classes and other stuff...from latest oreilly Learning Java, pg 623:
www.francesdelrio.com/java/TextEntryBox.java (SSCCE)
I have a few questions about this example:
1. a second class gets created (TextEntryBox$1.class) when this is
compiled, even though there's no inner class here..
2. it seems like a new instantation of ActionListener is being passed
in a meth arg.....
( field.addActionListener(new ActionListener( ) { )
when in fact ActionListener is an interface and as such cannot be
instantiated, only implemented.. (as far as I know...;)
3. and this ActionListener interface is not implemented anywhere here
that I can see....;)
could someone pls explain these things that seem contrary to what I have
read... (i.e., what I THOUGHT I understood... oh brother....)
thank you...
(PS: also, pls, why do some methods have a ');' after end of method
declaration?)
- 7
- Oracle Procedure out parameterHi,
I use a Oracle procedure with some out parameters.
How can I get it from a JSP/JSTL ?
I don't find any samples ....
Regards
Michael
- 7
- automatic apache + tomcat installationHi,
i hope someone can help me with my problem concerning the installation
of apache + tomcat:
i need to set up an installation of apache + tomcat under Windows by
script (unattended).
Any idea?
Thanks for Help in advance.
Michael
- 7
- Detect if Sun plugin is installed (in IE) EVEN if not set as default in plugin?I've looked everywhere and havent found a way to do what I need to do,
so I'll try posting this:
We have a need to sent users to one of 2 webpages depending on whether
they are using the MS JVM/1.1 or the Sun plugin/1.2+
What we did is create a simple applet that checks the java.version
property and forwards to the appropriate page depending on its value.
This should work fine except for one case:
If the user has the plugin installed but it is not set as the default
for IE, then IE will use the MS JVM when it encounters the applet tag,
and the user will get the 1.1 page even though they have the plugin
installed - we don't want that. Other requirements are that we only
need to support IE and we don't want the user to have to download the
plugin if they dont have it.
Can anyone think of anyone to do this? Can I use the OBJECT tag somehow
for this? Maybe nesting the OBJECT and APPLET tags? Also, if there was
anyway to detect the installation of the plugin using javascript it
would help.
Any ideas?
Thanks
Aaron
- 8
- Deadlock... i thinkI apologize in advance for the length of the note, and the source code
included.
I posted earlier under the title "Double streams", where i wanted to
use an RMI object as a sort of proxy for two clients to exchange data
via streams. I kinda failed, but now i'm trying something new. This
doesn't work either, but this time i think someone might be able to
solve it, since i'm not adept at using threads and i think that's
where the problem is. :)
The source for ByteHolder and RemoteByteHolder is included below. A
server is run, making a ByteHolder, BH, available via RMI.
Client A obtains the reference to BH, and passes this on to its
FooOutputStream, which extends OutputStream and implements the
write(int b) method by calling putByte(b) on BH.
Client B also gets BH, passes this to FooInputStream, which extends
InputStream and implements read() by calling getByte() on BH.
What i did to test was:
- run the server
- client A wraps the FooOutputStream in a PrintWriter, and
println("foo") is called on it
- client B wraps FooInputStream in a InputStreamReader, which is
then wrapped in a BufferedReader, and readLine() is called on that
The data then goes, one byte at the time, from client A to client B.
Client A stops running, but Client B just sorta hangs around... in a
deadlock i presume. I can make it return and print out the read line
by doing one of two things:
- kill the server
- manually send a -1 to client B
When i've used streams before, i didn't have to send a -1 in order to
get the reading side to get on with it - it just happened magically. I
also don't understand why killing the server make things better...
Can anyone explain this or, as an alternative, suggest a better way to
exchange bytes via RMI. I just really wanted to make streams work. :)
Oh, another thing. To make the server available, i've made it Runnable
and in the run i have a while(true) loop, that makes the thread sleep
for a chunk of time. Maybe that is a problem, too?
Regards,
Carsten H. Pedersen
----------- SOURCE BELOW -------------
package streams.holder;
import java.rmi.Remote;
import java.rmi.RemoteException;
public interface RemoteByteHolder extends Remote {
int getByte() throws RemoteException;
void putByte(int b) throws RemoteException;
}
...
package streams.holder;
import java.rmi.RemoteException;
public class ByteHolder implements RemoteByteHolder {
private int theByte;
private boolean stored = false;
public synchronized int getByte() throws RemoteException {
while(!stored) {
try {
wait();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
System.out.println("hb: get: "+theByte);
int i = theByte;
stored = false;
notifyAll();
return i;
}
public synchronized void putByte(int b) throws RemoteException {
while(stored) {
try {
wait();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
System.out.println("bh: put: "+b);
stored = true;
theByte = b;
notifyAll();
}
}
- 8
- Tv Need Extra Money for anything ?! Work for Top $ Tv/ I found this on a bulletin board and decided to try it: A little while back, I was browsing through news groups and e-mails, just like you are now, and came across an article similar to this that said you can make thousands of dollars within weeks with only an initial investment of $6.00!! So, I thought, "Yeah right, this must be a scam," but like most of us, I was curious, so I KEPT reading. Anyway, it said that you send $1.00 to each of the six names and addresses stated in the article. You then place your own name and address in the bottom of the list at $6.00, and post the article in at least 200 news groups. (There are thousands) No catch, that was it. So after thinking it over, and talking to a few people first, I thought about trying it. I figured, "What have I got to lose; except six stamps and $6.00 right, right?" Then I invested the measly $6.00.
WELL GUESS WHAT!!!
Within seven days, I started getting money in the mail!! I was shocked!! I figured it would end soon, but the money just kept coming in. In my first week, I made about $25.00. By the end of the second week I had made a total of more than $1000.00!! In the third week I had more than $10,000.00 and it's still growing!! This is now my fourth week and I have made a total of $42,000.00 and it's still coming rapidly. It's certainly worth $6.00 and six stamps, and I have spent more than that on the lottery without ever winning!!!
Let me tell you how this works and most important, why it works.......... also make sure you print this out NOW, so you can get the information off of it, as you will need it. I promise you that if you follow the directions exactly that you will start making more money than you thought possible by doing something so easy!!
Suggestion: Read this entire message carefully!! (Print it out or download it)
Follow the simple directions and watch the money come in!! It's easy. It's legal. And, your investment is only $6.00 (Plus postage)!!!
IMPORTANT:
This is not a rip-off, it is decent; it's legal; and it is virtually no risk - it really works!! If all the following instructions are adhered to, you will receive extraordinary dividends.
PLEASE NOTE:
Please follow the directions EXACTLY, and $50,000 or more can be yours in 20 to 60 days. This program remains successful because of the honesty and integrity of the participants. Please continue its success by carefully adhering to the instructions. You will now become apart of the Mail Order business. You are in the business of developing Mailing Lists. Many large corporations are happy to pay big bucks for quality lists. However, the money made from the mailing lists is secondary to income, which is made from people like you and me asking to be included in that list. Here are the four easy steps to success.
STEP ONE: Get six separate pieces of paper and write the following on each piece of paper "PLEASE PUT ME ON YOUR MAILING LIST." Now get 6 U.S. $1.00 bills and place ONE inside of EACH of the six pieces of paper so the bill will not be seen through the envelope (to prevent thievery). Next, place one paper in each of the six envelopes and seal them. You now should have six sealed envelopes, each with a piece of paper stating the above phrase, your name and address, and a $1.00 bill. What you are doing is creating a service.
THIS IS ABSOLUTELY LEGAL!!!!!
You are requesting a legitimate service and you are paying for it!! Like most of us I was a little skeptical and little worried about the legal aspects of it all. So I checked it out with the U.S. Post Office (1-800-238-5355) and they confirmed that it is indeed legal!!
Mail the six envelopes to the following addresses:
1) W. Edens
4829 Bud Ln
Lexington, KY 40514
2) L.Lessard
40 Martins Ferry Rd
Hooksett,NH 03106
3) J. Safian
6950 W. Forest Presrv. Dr., #115
Norridge, IL 60706-1324
4) G. Takla
690 Adelaide Avenue East
Oshawa, Ontario, L1G 2A8
5) Q. Huda
1212- 1315 Bough Beeches Blvd.
Mississauga, Ontario, L4W 4A1
6) T Ryan
275 Rt 10E Ste 220-301
Succasunna, NJ 07876
STEP TWO: Now take the #1 name off the list that you see above, move the other names up (six becomes 5, 5 becomes 4, and etc.) and add YOUR NAME as number 6 on the list.
STEP THREE: Change anything you need to but try to keep this article as close to original as possible. Now post your amended article to at least 200 news groups. :
(I think there are close to 24,000 groups) All you need is 200, but remember, the more you post, the more money you make!! This is perfectly legal!! If you have any doubts, refer to Title 18 Sec. 1302 & 1341 of the Postal Lottery laws. Keep a copy of these steps for yourself and whenever you need money, you can use it again, and again. PLEASE REMEMBER that this program remains successful because of the honesty and integrity of the participants and by their carefully adhering to directions. Look at it this way. If you were of integrity, the program will continue and the money that so many others have received will come your way.
NOTE: You may want to retain every name and address sent to you, either on a computer or hard copy and keep the notes people send you. This VERIFIES that you are truly providing a service. (Also, it might be a good idea to wrap the $1 bill in dark paper to reduce the risk of mail theft). So, as each post is downloaded and the directions carefully followed, all members will be reimbursed for their participation as a List Developer with one dollar each. Your name will move up the list geometrically so that when your name reaches the #1 position you will be receiving thousands of dollars in CASH!!! What an opportunity for only $6.00 ($1.00 for each of the first six people listed above) Send it now, add your own name to the list and you're in business!!!
*****DIRECTIONS FOR HOW TO POST TO NEWS GROUPS!!!*****
STEP ONE: You do not need to re-type this entire letter to do your own posting. Simply put your cursor at the beginning of this letter and drag your cursor to the bottom of this document, and select 'copy' from the edit menu. This will copy the entire letter into the computer's memory.
STEP TWO: Open a blank 'notepad' file and place your cursor at the top of the blank page. From the 'edit' menu select 'paste'. This will paste a copy of the letter into the notepad so that you will add your name to the list.
STEP THREE: Save your new notepad file as a text file. If you want to do your posting in different settings, you'll always have this file to go back to.
STEP FOUR: You can use a program like "postXpert" to post to all the newsgroups at once. You can find this program at <http://www.download.com>. If you don't understand how it works you can email me at: mailto:email***@***.com (this is only when my name is in the list, so send a copy of my address as well. put this in the header: make millions very easy + my full name)
Use Netscape or Internet Explorer and try searching for various new groups (on- line forums, message boards, chat sites, discussions.)
STEP FIVE: Visit message boards and post this article as a new message by highlighting the text of this letter and selecting paste from the edit menu. Fill in the subject, this will be the header that everyone sees as they scroll through the list of postings in a particular group, click the post message button. You're done.
Congratulations!!!!!!
THAT'S IT!! All you have to do, and It Really works!!!
Best Wishes
$A
- 10
- JaveHi
I need some help, I need to learn about java. What books, authors are the
best.
- 10
- 11
- Searching and replacing multiple strings in textSuppose I have a String like:
"The quick brown fox jumped over the lazy dog's back."
Suppose I wanted to make the following multiple replacements in the
String:
"quick" -> "slow"
"brown" -> "red"
"jump" -> "walk"
"over" -> "under"
"back" -> "stomach"
After making the replacements, the String becomes:
"The slow red fox walked under the lazy dog's stomach."
It would be easy to just scan the string N times if we're replacing N
words but I'd like a way that scans the string only once regardless of
how many words we're replacing. I'm sure tons of programmers have had
need for this and I'm wondering if there's already some existing code
on the net for it.
If not, then what are the best data structures and classes to use for
this? For example, should the collection of words to replace just be a
String[] and the collection of replacements just be a String[], so
that e.g. wordsToReplace[i] is replaced by replacement[i], and then
you do the search and replace algorithm something loosely along the
idea of:
0. assume an input String, an output StringBuffer
1. set c = current input text character
2. if c is the first character of any of the words in wordsToReplace[]
then
2a. check if the next input character is the next character of
any of the words in our input string and so forth....
if the input word is a match, append the replacement
to the output StringBuffer.
otherwise, append the character c from step 1 to the
StringBuffer and
go back to step 1. with the input character
advanced to the next character.
I'm being very sloppy and crude here and only trying to illustrate the
idea, because actually programming the above function while making
sure you handle all the out-of-bounds cases, etc., would be tricky and
time-consuming, and I want to post here for a pre-canned solution or
something easy I haven't thought of yet before going to all the
trouble.
Thanks very much for any replies.
Chris
- 13
- swing - styled document - paragraph attributeHello,
1) I assign a document style by
style = myDefaultStyledDocument.addStyle("myStyle" , null);
StyleConstants.setAlignment(style, 1); //1 for center
myDefaultStyledDocument.setLogicalStyle(pos, style);
2) Then, I try to read the style :
AttributeSet attributeSet = myDefaultStyledDocument.getAttributes();
Enumeration attrEnum = attributeSet.getAttributeNames();
while ( attrEnum.hasMoreElements() ) {
Object attrObj = attrEnum.nextElement();
System.err.println("attrObj:"+attrObj.getClass());
}
I read only classes of StyleConstants.ResolveAttribute!...
Strange no ?
For all other StyleConstants that's ok !!
Is there something special to do with Alignment ?
FLD
- 13
- Changing fonts in a JTable header I've been trying to figure out how to change the font in a JTable column
header to bold. I've been accessing the TableColumnModel().getColumn(x) for
the column I want, but i don't see any getFont or setFont methods which are
available.
Can someone point me in the right direction on how to change the header
text to bold in a JTable?
Thanks!
[Tim]
|
| Author |
Message |
Frank Brouwer

|
Posted: 2003-10-7 0:47:00 |
Top |
java-programmer, Memory issue
Hi All,
I have a problem with memory when I use a connection to a database. I have
also posted the question in the database group but as I suspect that it has
to do with garbage collection I also post the question here.
I have a problem with memory using SQLserver on a server running WIN2K
Advanced Server with 2 GB! of internal memory. We limmited the SQLserver
memory to 1 GB and 512 MB for JVM (version 1.4.2_01). The OutOfMemory error
is always at the same place in the jdbc driver as shown below.
java.lang.OutOfMemoryError
at com.microsoft.util.UtilPagedTempBuffer.compressBlockList(Unknown Source)
at com.microsoft.util.UtilPagedTempBuffer.getBlock(Unknown Source)
at com.microsoft.util.UtilPagedTempBuffer.write(Unknown Source)
at com.microsoft.util.UtilPagedTempBuffer.write(Unknown Source)
at com.microsoft.util.UtilByteArrayDataProvider.receive(Unknown Source)
at com.microsoft.util.UtilByteOrderedDataReader.receive(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSRPCRequest.submitRequest(Unknown
Source)
at com.microsoft.jdbc.sqlserver.tds.TDSCursorRequest.openCursor(Unknown
Source)
at com.microsoft.jdbc.sqlserver.SQLServerImplStatement.execute(Unknown
Source)
at com.microsoft.jdbc.base.BaseStatement.commonExecute(Unknown Source)
at com.microsoft.jdbc.base.BaseStatement.executeQueryInternal(Unknown
Source)
at com.microsoft.jdbc.base.BasePreparedStatement.executeQuery(Unknown
Source)
.............................................. Truncated from here
.................................................
If I run (using same database & JVM) on a computer (W2K prof.) with 512 MB
internal memory and no limmit set for MS-Sqlserver but for JVM 128 MB doing
the same stuff, there is no problem at all.
I suspect it has something to do with a late "kicking in" of the Garbage
Collection causing memory segmentation. So when a big chunk of memory is
required (a large result-set from the database) no contigouis memory block
of memory is availble in the current heap. The JVM claims more memory to
expand the heap, grows and grows until it cosses the limmit. But I also
tought that garbage collection takes care of that too.
I hope some one has seen this behaviour and can point me in the right
direction.
TIA.
Frank.
--
Met vriendelijke groet,
Frank Brouwer
_________________________________________________
Trimergo BV
Project Manufacturing Software
Amersfoortseweg 15 C
7313 AB Apeldoorn, Nederland
Telefoon: 055 - 577 7373
Telefax: 055 - 577 7370
www.trimergo.com
|
| |
|
| |
 |
James

|
Posted: 2003-10-7 23:17:00 |
Top |
java-programmer >> Memory issue
Can you post a complete example of your call to the database. Are you
connection pooling? Are you releasing connections back into the pool or is
the pool growing too large? Are you manipulating arrays - any dangling
references? The data coming back - is it huge? Are any result sets hanging
around? Just a few questions that may spark something.
"Frank Brouwer" <email***@***.com> wrote in message
news:3f819c9c$0$445$email***@***.com...
> Hi All,
>
> I have a problem with memory when I use a connection to a database. I
have
> also posted the question in the database group but as I suspect that it
has
> to do with garbage collection I also post the question here.
>
> I have a problem with memory using SQLserver on a server running WIN2K
> Advanced Server with 2 GB! of internal memory. We limmited the SQLserver
> memory to 1 GB and 512 MB for JVM (version 1.4.2_01). The OutOfMemory
error
> is always at the same place in the jdbc driver as shown below.
>
> java.lang.OutOfMemoryError
> at com.microsoft.util.UtilPagedTempBuffer.compressBlockList(Unknown
Source)
> at com.microsoft.util.UtilPagedTempBuffer.getBlock(Unknown Source)
> at com.microsoft.util.UtilPagedTempBuffer.write(Unknown Source)
> at com.microsoft.util.UtilPagedTempBuffer.write(Unknown Source)
> at com.microsoft.util.UtilByteArrayDataProvider.receive(Unknown Source)
> at com.microsoft.util.UtilByteOrderedDataReader.receive(Unknown Source)
> at com.microsoft.jdbc.sqlserver.tds.TDSRPCRequest.submitRequest(Unknown
> Source)
> at com.microsoft.jdbc.sqlserver.tds.TDSCursorRequest.openCursor(Unknown
> Source)
> at com.microsoft.jdbc.sqlserver.SQLServerImplStatement.execute(Unknown
> Source)
> at com.microsoft.jdbc.base.BaseStatement.commonExecute(Unknown Source)
> at com.microsoft.jdbc.base.BaseStatement.executeQueryInternal(Unknown
> Source)
> at com.microsoft.jdbc.base.BasePreparedStatement.executeQuery(Unknown
> Source)
> .............................................. Truncated from here
> .................................................
>
> If I run (using same database & JVM) on a computer (W2K prof.) with 512 MB
> internal memory and no limmit set for MS-Sqlserver but for JVM 128 MB
doing
> the same stuff, there is no problem at all.
>
> I suspect it has something to do with a late "kicking in" of the Garbage
> Collection causing memory segmentation. So when a big chunk of memory is
> required (a large result-set from the database) no contigouis memory block
> of memory is availble in the current heap. The JVM claims more memory to
> expand the heap, grows and grows until it cosses the limmit. But I also
> tought that garbage collection takes care of that too.
>
> I hope some one has seen this behaviour and can point me in the right
> direction.
>
> TIA.
>
> Frank.
>
>
> --
> Met vriendelijke groet,
> Frank Brouwer
>
> _________________________________________________
>
> Trimergo BV
> Project Manufacturing Software
>
> Amersfoortseweg 15 C
> 7313 AB Apeldoorn, Nederland
> Telefoon: 055 - 577 7373
> Telefax: 055 - 577 7370
>
> www.trimergo.com
>
>
|
| |
|
| |
 |
Frank Brouwer

|
Posted: 2003-10-7 23:53:00 |
Top |
java-programmer >> Memory issue
Hi James,
"James" <email***@***.com> wrote in message
news:9OAgb.516621$cF.185652@rwcrnsc53...
> Can you post a complete example of your call to the database. Are you
> connection pooling? Are you releasing connections back into the pool or
is
> the pool growing too large? Are you manipulating arrays - any dangling
> references? The data coming back - is it huge? Are any result sets
hanging
> around? Just a few questions that may spark something.
>
I'm not using a pool and use prepared statements only, the close() method's
are invoked when needed. The resultSet is evaluated in a loop and the data
is put into objects which are passed as an Enumeration or Iterator to the
caller. But even if all your suggestions would be the case, it does not
explain why it works on a computer with limited resources (like a note-book)
and not on a machine with plenty resources (big server).
Thanks for thinking with me,
Frank.
|
| |
|
| |
 |
James

|
Posted: 2003-10-8 5:12:00 |
Top |
java-programmer >> Memory issue
Well the reason it works on one machine and not the other is that very
little is guaranteed about the JVM and memory amangement, and different
machines and coinfigurations can result in different behavior. I would not
focus on the machine difference, it is in the code. After close, set the
objects to null and make sure the results are cleaned up after they are
sent. Again, no problem, tossing out the things i would check. "Frank
Brouwer" <email***@***.com> wrote in message
news:3f82e142$0$437$email***@***.com...
> Hi James,
>
> "James" <email***@***.com> wrote in message
> news:9OAgb.516621$cF.185652@rwcrnsc53...
> > Can you post a complete example of your call to the database. Are you
> > connection pooling? Are you releasing connections back into the pool or
> is
> > the pool growing too large? Are you manipulating arrays - any dangling
> > references? The data coming back - is it huge? Are any result sets
> hanging
> > around? Just a few questions that may spark something.
> >
>
> I'm not using a pool and use prepared statements only, the close()
method's
> are invoked when needed. The resultSet is evaluated in a loop and the
data
> is put into objects which are passed as an Enumeration or Iterator to the
> caller. But even if all your suggestions would be the case, it does not
> explain why it works on a computer with limited resources (like a
note-book)
> and not on a machine with plenty resources (big server).
>
> Thanks for thinking with me,
>
> Frank.
>
>
|
| |
|
| |
 |
spalding

|
Posted: 2004-8-5 22:42:00 |
Top |
java-programmer >> Memory issue
Koen wrote:
> I also had some OutOfMemoryExceptions while the 2GB limit was stil
> far off.
> I read somewhere about an issue with a 1GB limit but it seems relate
> to
> specific allocation sizes. We had situations where almost eac
> allocation
> done by the website throws OutofMemoryExceptions, even after man
> sessions
> timed-out and so a lot of memory was no longer rooted.
> end [/B]
Hi
I too was getting OutOfMemoryException(s) when users were posting file
to asp.net application via an html form. I set the maxRequestLength i
web.config to about 1GB and tried to upload a 170MB file but afte
about 120MB I would get the above error.
The reason was that asp.net was storing the entire contents of the fil
in memory and at 120MB it would recycle the asp_wp process.
According to the link below, the memoryLimit
attribute in the machine.config file specifies the
percentage of memory the asp_wp process can use before being recycled.
http://tinyurl.com/6lcna
I was able to get around this problem by parsing the posted form
stripping the file contents from the rest of the form and at the sam
time writing it to a file on disk
-
spaldin
-----------------------------------------------------------------------
Posted via http://www.codecomments.co
-----------------------------------------------------------------------
|
| |
|
| |
 |
jamesche

|
Posted: 2004-8-6 2:35:00 |
Top |
java-programmer >> Memory issue
Koen,
It's very hard to tell anything from your graphic because several counters
share the same color. In order to tell anything, we'd need the .csv or
.blg file from Perfmon. I can't tell if your virtual memory is the top
yellow line or if that's private bytes. This is important to know because
in order for you to conclude that this may be a native leak, you'd need to
confirm that private bytes is increasing while the # Bytes in all Heaps is
decreasing or stays flat. I can't tell that from this screenshot.
I also don't know if you are running ASP.NET 1.0 or 1.1. The memory model
was changed in 1.1.
If you are interested in an article that gives some detail on how you can
debug memory issues, here is a great one from PAG:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnbda/html/
DBGch02.asp?frame=true
Jim Cheshire [MSFT]
MCP+I, MCSE, MCSD, MCDBA
Microsoft Developer Support
email***@***.com
This post is provided "AS-IS" with no warranties and confers no rights.
--------------------
>From: "Koen" <email***@***.com>
>Subject: memory issue
>Date: Thu, 5 Aug 2004 14:58:54 +0200
>Lines: 171
>X-Priority: 3
>X-MSMail-Priority: Normal
>X-Newsreader: Microsoft Outlook Express 6.00.2800.1437
>X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
>Message-ID: <email***@***.com>
>Newsgroups: microsoft.public.dotnet.framework.aspnet
>NNTP-Posting-Host: isa-dgm1.bvdep.com 193.194.158.107
>Path:
cpmsftngxa06.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP12
.phx.gbl
>Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.aspnet:252309
>X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
>
>I've been reading a lot about GC and finding memory leaks etc. However I
>don't understand the memory behavior of our asp.net site.
>
>Here is what happens : when garbage collection combes by, it finds plenty
of
>memory no longer referenced (expired sessions) and this memory is freed
(see
>attached system monitor snapshot). So the #bytes in all heaps goes down by
>300MB. At the same time the total committed bytes on the server goes down
as
>well as the private bytes of the asp_wp process. However the virtual bytes
>of the process stay unchanged.
>Now I know that this happens if your CLR allocations are in the large
object
>heap because this is never compacted, but as the snapshot shows this is not
>the case, the freed memory was in the generation 2 heap
>
>The distance between CLR memory and virtual memory increases and that would
>mean memory leaks in native code called. However I would then expect the
>distance to increase mostly while GC is doing nothing, however I see the
>distance increase when CLR memory is freed while during CLR memory increase
>the Virtual bytes increase along (not immediately after a strong drop but
>shortly after)
>
>Is this the problem described in KB 833610 ? Or is it still something
>different ? Do I have to worry about native memory leaks ?
>
>I also had some OutOfMemoryExceptions while the 2GB limit was still far
off.
>I read somewhere about an issue with a 1GB limit but it seems related to
>specific allocation sizes. We had situations where almost each allocation
>done by the website throws OutofMemoryExceptions, even after many sessions
>timed-out and so a lot of memory was no longer rooted.
>
>Koen.
>
>
>
|
| |
|
| |
 |
Koen

|
Posted: 2004-8-6 15:56:00 |
Top |
java-programmer >> Memory issue
Jim,
Thank you for your reply. Actually the same color for different lines didn't
bother me as total VM > committed bytes > private bytes
To be able to compare them I forced all monitors to the same scale (I should
have said that or have included it in my snapshot)
Your explanation of detecting a native leak is what I alos knew - and yes it
is true bytes in heap go down while VM stays flat - but I am surprised that
I don't see VM size go down when the garbage collection frees CLR memory.
I read (before posting) the MSDN article, but before starting up the tools
mentioned I tried to deduce just from the performance monitor if I should
look at the CLR or at native memory. I am quite sure that my problem is not
comming from rooted objects in the CLR.
Koen.
"Jim Cheshire [MSFT]" <email***@***.com> wrote in message
news:email***@***.com...
> Koen,
>
> It's very hard to tell anything from your graphic because several counters
> share the same color. In order to tell anything, we'd need the .csv or
> blg file from Perfmon. I can't tell if your virtual memory is the top
> yellow line or if that's private bytes. This is important to know because
> in order for you to conclude that this may be a native leak, you'd need to
> confirm that private bytes is increasing while the # Bytes in all Heaps is
> decreasing or stays flat. I can't tell that from this screenshot.
>
> I also don't know if you are running ASP.NET 1.0 or 1.1. The memory model
> was changed in 1.1.
>
> If you are interested in an article that gives some detail on how you can
> debug memory issues, here is a great one from PAG:
>
>
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnbda/html/
> DBGch02.asp?frame=true
>
> Jim Cheshire [MSFT]
> MCP+I, MCSE, MCSD, MCDBA
> Microsoft Developer Support
> email***@***.com
>
> This post is provided "AS-IS" with no warranties and confers no rights.
>
> --------------------
> >Here is what happens : when garbage collection combes by, it finds plenty
> of
> >memory no longer referenced (expired sessions) and this memory is freed
> (see
> >attached system monitor snapshot). So the #bytes in all heaps goes down
by
> >300MB. At the same time the total committed bytes on the server goes down
> as
> >well as the private bytes of the asp_wp process. However the virtual
bytes
> >of the process stay unchanged.
|
| |
|
| |
 |
Koen

|
Posted: 2004-8-6 16:00:00 |
Top |
java-programmer >> Memory issue
we are using framework 1.1
"Jim Cheshire [MSFT]" <email***@***.com> wrote in message
news:email***@***.com...
> >
> I also don't know if you are running ASP.NET 1.0 or 1.1. The memory model
> was changed in 1.1.
>
|
| |
|
| |
 |
jamesche

|
Posted: 2004-8-6 23:33:00 |
Top |
java-programmer >> Memory issue
Koen,
In order to really tell what's going on for certain, you really need to
examine the memory in a user mode debugger. Using Perfmon, you can tell
that you are using x bytes of memory, but you don't know what sits in x
bytes. You don't know what's rooted and what's not. You don't know what
has been collected and what has not. (When I say "what" here, I don't mean
how much. I mean what objects.)
Perfmon is great for determining if you are really looking at a leak
situation (and what you have described is not a leak), but once you find
the 30,000 details provided by Perfmon, it's time to dig in with a dump and
user mode debugging.
Jim Cheshire [MSFT]
MCP+I, MCSE, MCSD, MCDBA
Microsoft Developer Support
email***@***.com
This post is provided "AS-IS" with no warranties and confers no rights.
--------------------
>From: "Koen" <email***@***.com>
>References: <email***@***.com>
<email***@***.com>
>Subject: Re: memory issue
>Date: Fri, 6 Aug 2004 09:56:42 +0200
>Lines: 60
>X-Priority: 3
>X-MSMail-Priority: Normal
>X-Newsreader: Microsoft Outlook Express 6.00.2800.1437
>X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
>Message-ID: <email***@***.com>
>Newsgroups: microsoft.public.dotnet.framework.aspnet
>NNTP-Posting-Host: isa-dgm1.bvdep.com 193.194.158.107
>Path:
cpmsftngxa06.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP09
.phx.gbl
>Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.aspnet:252539
>X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
>
>Jim,
>
>Thank you for your reply. Actually the same color for different lines
didn't
>bother me as total VM > committed bytes > private bytes
>To be able to compare them I forced all monitors to the same scale (I
should
>have said that or have included it in my snapshot)
>Your explanation of detecting a native leak is what I alos knew - and yes
it
>is true bytes in heap go down while VM stays flat - but I am surprised
that
>I don't see VM size go down when the garbage collection frees CLR memory.
>
>I read (before posting) the MSDN article, but before starting up the tools
>mentioned I tried to deduce just from the performance monitor if I should
>look at the CLR or at native memory. I am quite sure that my problem is not
>comming from rooted objects in the CLR.
>
>Koen.
>
>"Jim Cheshire [MSFT]" <email***@***.com> wrote in message
>news:email***@***.com...
>> Koen,
>>
>> It's very hard to tell anything from your graphic because several
counters
>> share the same color. In order to tell anything, we'd need the .csv or
>> blg file from Perfmon. I can't tell if your virtual memory is the top
>> yellow line or if that's private bytes. This is important to know
because
>> in order for you to conclude that this may be a native leak, you'd need
to
>> confirm that private bytes is increasing while the # Bytes in all Heaps
is
>> decreasing or stays flat. I can't tell that from this screenshot.
>>
>> I also don't know if you are running ASP.NET 1.0 or 1.1. The memory
model
>> was changed in 1.1.
>>
>> If you are interested in an article that gives some detail on how you can
>> debug memory issues, here is a great one from PAG:
>>
>>
>http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnbda/html
/
>> DBGch02.asp?frame=true
>>
>> Jim Cheshire [MSFT]
>> MCP+I, MCSE, MCSD, MCDBA
>> Microsoft Developer Support
>> email***@***.com
>>
>> This post is provided "AS-IS" with no warranties and confers no rights.
>>
>> --------------------
>> >Here is what happens : when garbage collection combes by, it finds
plenty
>> of
>> >memory no longer referenced (expired sessions) and this memory is freed
>> (see
>> >attached system monitor snapshot). So the #bytes in all heaps goes down
>by
>> >300MB. At the same time the total committed bytes on the server goes
down
>> as
>> >well as the private bytes of the asp_wp process. However the virtual
>bytes
>> >of the process stay unchanged.
>
>
>
|
| |
|
| |
 |
jeffvandenberg

|
Posted: 2007-7-3 3:55:00 |
Top |
java-programmer >> Memory issue
I just upgraded a small web server to php 5.2.2 and apache to 2.2.4 on
a Win2K Pro box with MySQL 5. The only customization is loading MySQL
and MySQLi modules in PHP. Things had been working well enough under
PHP 4 and Apache 2.0, but I was wanting to upgrade to the latest and
greatest to toy with things and experiment.
However, I have noticed something that I think may be PHP's fault, but
i'm not sure. I'm seeing a memory leak in Apache. I was wondering if
there was something different about how PHP handled MySQLi result sets
or anything? I don't free_result() on all of my select statements
(this is very much an experimental site, though I'm trying to fix it
up). I'm seeing considerably more memory usage under this setup than
before I did the upgrade.
Regards,
Jeff Vandenberg
|
| |
|
| |
 |
Jason.Herald@gmail.com

|
Posted: 2008-2-14 2:49:00 |
Top |
java-programmer >> Memory issue
I am having an issue where a struts based application continually
uses more and more ram. I get the available memory on each pass and
manually call gc which has slowed the issue but not fixed it.
I.e:
public ActionForward view (ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) {
Session ses = new SessionManager().getSession();
Rooms rooms = new Rooms(ses);
Posts posts = new Posts(ses);
HttpSession session = request.getSession();
List room_list = rooms.find_all();
request.setAttribute("rooms", room_list);
List post_list = posts.full_set(new
Long(session.getAttribute("room_id").toString()));
request.setAttribute("posts", post_list);
rooms = null;
posts = null;
/* runtime variable r is declared above */
r.gc();
return mapping.findForward("done");
}
The memory usage follows this pattern:
Pass 1: (before gc) 231.4797 (after gc) 242.2315
Pass 2: (before gc) 232.2050 (after gc) 241.6035
Pass 3: (before gc) 231.8197 (after gc) 241.2478
JVM is started using (although I have tried many different
combinations of the arguments):
-server -XX:+CMSClassUnloadingEnabled -XX:PermSize=128M -
XX:MaxPermSize=128M -Xconcurrentio -XX:+UseConcMarkSweepGC -
XX:NewRatio=30 -XX:+UseParNewGC -XX:NewSize=8m -XX:MaxNewSize=8m -
Xms256m -Xmx256m -XX:MinHeapFreeRatio=70 -XX:MaxHeapFreeRatio=90
Any ideas would be greatly appreciated and if you want to see any of
the other files let me know.
Thanks in advance!
Jason
|
| |
|
| |
 |
Jason.Herald@gmail.com

|
Posted: 2008-2-14 3:45:00 |
Top |
java-programmer >> Memory issue
I am having an issue where a struts based application continually
uses more and more ram. I get the available memory on each pass and
manually call gc which has slowed the issue but not fixed it.
I.e:
public ActionForward view (ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) {
Session ses = new SessionManager().getSession();
Rooms rooms = new Rooms(ses);
Posts posts = new Posts(ses);
HttpSession session = request.getSession();
List room_list = rooms.find_all();
request.setAttribute("rooms", room_list);
List post_list = posts.full_set(new
Long(session.getAttribute("room_id").toString()));
request.setAttribute("posts", post_list);
rooms = null;
posts = null;
/* runtime variable r is declared above */
r.gc();
return mapping.findForward("done");
}
The memory usage follows this pattern:
Pass 1: (before gc) 231.4797 (after gc) 242.2315
Pass 2: (before gc) 232.2050 (after gc) 241.6035
Pass 3: (before gc) 231.8197 (after gc) 241.2478
JVM is started using (although I have tried many different
combinations of the arguments):
-server -XX:+CMSClassUnloadingEnabled -XX:PermSize=128M -
XX:MaxPermSize=128M -Xconcurrentio -XX:+UseConcMarkSweepGC -
XX:NewRatio=30 -XX:+UseParNewGC -XX:NewSize=8m -XX:MaxNewSize=8m -
Xms256m -Xmx256m -XX:MinHeapFreeRatio=70 -XX:MaxHeapFreeRatio=90
Any ideas would be greatly appreciated and if you want to see any of
the other files let me know.
Thanks in advance!
Jason
|
| |
|
| |
 |
none

|
Posted: 2008-2-14 6:16:00 |
Top |
java-programmer >> Memory issue
email***@***.com wrote:
> I am having an issue where a struts based application continually
> uses more and more ram. I get the available memory on each pass and
> manually call gc which has slowed the issue but not fixed it.
>
> I.e:
> public ActionForward view (ActionMapping mapping,
> ActionForm form,
> HttpServletRequest request,
> HttpServletResponse response) {
>
> Session ses = new SessionManager().getSession();
>
> Rooms rooms = new Rooms(ses);
> Posts posts = new Posts(ses);
>
> HttpSession session = request.getSession();
>
> List room_list = rooms.find_all();
> request.setAttribute("rooms", room_list);
>
>
> List post_list = posts.full_set(new
> Long(session.getAttribute("room_id").toString()));
> request.setAttribute("posts", post_list);
>
> rooms = null;
> posts = null;
>
> /* runtime variable r is declared above */
> r.gc();
>
> return mapping.findForward("done");
>
> }
>
>
> The memory usage follows this pattern:
>
> Pass 1: (before gc) 231.4797 (after gc) 242.2315
> Pass 2: (before gc) 232.2050 (after gc) 241.6035
> Pass 3: (before gc) 231.8197 (after gc) 241.2478
>
> JVM is started using (although I have tried many different
> combinations of the arguments):
>
> -server -XX:+CMSClassUnloadingEnabled -XX:PermSize=128M -
> XX:MaxPermSize=128M -Xconcurrentio -XX:+UseConcMarkSweepGC -
> XX:NewRatio=30 -XX:+UseParNewGC -XX:NewSize=8m -XX:MaxNewSize=8m -
> Xms256m -Xmx256m -XX:MinHeapFreeRatio=70 -XX:MaxHeapFreeRatio=90
>
> Any ideas would be greatly appreciated and if you want to see any of
> the other files let me know.
>
> Thanks in advance!
>
> Jason
it's hard to say without the list of imports and without the code of the
beans Room and Post.
by the way the before gc value deos not seem to grow...
|
| |
|
| |
 |
Daniel Pitts

|
Posted: 2008-2-14 6:30:00 |
Top |
java-programmer >> Memory issue
email***@***.com wrote:
> I am having an issue where a struts based application continually
> uses more and more ram. I get the available memory on each pass and
> manually call gc which has slowed the issue but not fixed it.
>
[snip code]
> Any ideas would be greatly appreciated and if you want to see any of
> the other files let me know.
>
> Thanks in advance!
>
> Jason
Unless you are seeing an Out Of Memory exception, don't worry about
available memory. The Garbage Collector doesn't necessarily pick things
up as soon as they're no longer needed.
You might also make sure that you're not holding on to objects in static
maps/collections or long lived maps/collections.
--
Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/>
|
| |
|
| |
 |
Mark Space

|
Posted: 2008-2-14 6:55:00 |
Top |
java-programmer >> Memory issue
email***@***.com wrote:
> Pass 1: (before gc) 231.4797 (after gc) 242.2315
> Pass 2: (before gc) 232.2050 (after gc) 241.6035
> Pass 3: (before gc) 231.8197 (after gc) 241.2478
First pass, memory went up. First time you use this object more memory
is needed. Second and third pass, memory use went down. So I don't see
that memory is increasing here. I don't think there are any errors in
the program.
Let this app run for a long time. Monitor it. Is it actually
increasing in memory use over the long haul? Do objects eventually time
out and get released and memory reclaimed? (Make sure your session
objects all time out.) Does the GC continue to run with increasing
frequency and less results? Do you eventually get an Out of Memory Error?
Need more info here. Looks ok to me.
Look up some debugging info for Java, especially JMX. Use that. Get
rid of the gratuitous call to the GC, it isn't needed.
|
| |
|
| |
 |
Lew

|
Posted: 2008-2-14 8:04:00 |
Top |
java-programmer >> Memory issue
Daniel Pitts wrote:
> email***@***.com wrote:
>> I am having an issue where a struts based application continually
>> uses more and more ram. I get the available memory on each pass and
>> manually call gc which has slowed the issue but not fixed it.
>>
> [snip code]
>> Any ideas would be greatly appreciated and if you want to see any of
>> the other files let me know.
>>
>> Thanks in advance!
>>
>> Jason
> Unless you are seeing an Out Of Memory exception, don't worry about
> available memory. The Garbage Collector doesn't necessarily pick things
> up as soon as they're no longer needed.
>
> You might also make sure that you're not holding on to objects in static
> maps/collections or long lived maps/collections.
For those who answered on clj.programmer, there is more in response to the
clj.help multipost, and vice versa.
To the OP: Please do not multi-post. Read the FAQ post from David Alex Lamb,
"comp.lang.java.{help,programmer} - what they're for (mini-FAQ 2006-03-31)",
and its links for details. The FAQ is posted every five days, so there are no
worries about missing it.
Cross-posted in service of the OP.
--
Lew
|
| |
|
| |
 |
Jason.Herald@gmail.com

|
Posted: 2008-2-14 9:04:00 |
Top |
java-programmer >> Memory issue
On Feb 13, 5:16爌m, none <""mrloyal\"@(none)"> wrote:
> email***@***.com wrote:
> > I am 爃aving an issue where a struts based application continually
> > uses more and more ram. 營 get the available memory on each pass and
> > manually call gc which has slowed the issue but not fixed it.
>
> > I.e:
> > ??public ActionForward view (ActionMapping mapping,
> > ????????????????燗ctionForm form,
> > ????????????????燞ttpServletRequest request,
> > ????????????????燞ttpServletResponse response) {
>
> > ????Session ses = new SessionManager().getSession();
>
> > ????Rooms rooms = new Rooms(ses);
> > ????Posts posts = new Posts(ses);
>
> > ????HttpSession session = request.getSession();
>
> > ????List room_list = rooms.find_all();
> > ????request.setAttribute("rooms", room_list);
>
> > ????List post_list = posts.full_set(new
> > Long(session.getAttribute("room_id").toString()));
> > ????request.setAttribute("posts", post_list);
>
> > ????rooms = null;
> > ????posts = null;
>
> > /* runtime variable r is declared above */
> > ????r.gc();
>
> > ????return mapping.findForward("done");
>
> > ??}
>
> > The memory usage follows this pattern:
>
> > Pass 1: (before gc) 231.4797 (after gc) 242.2315
> > Pass 2: (before gc) 232.2050 (after gc) 241.6035
> > Pass 3: (before gc) 231.8197 (after gc) 241.2478
>
> > JVM is started using (although I have tried many different
> > combinations of the arguments):
>
> > -server -XX:+CMSClassUnloadingEnabled -XX:PermSize=128M -
> > XX:MaxPermSize=128M -Xconcurrentio -XX:+UseConcMarkSweepGC -
> > XX:NewRatio=30 -XX:+UseParNewGC -XX:NewSize=8m -XX:MaxNewSize=8m -
> > Xms256m -Xmx256m -XX:MinHeapFreeRatio=70 -XX:MaxHeapFreeRatio=90
>
> > Any ideas would be greatly appreciated and if you want to see any of
> > the other files let me know.
>
> > Thanks in advance!
>
> > Jason
>
> it's hard to say without the list of imports and without the code of the
> beans Room and Post.
> by the way the before gc value deos not seem to grow...- Hide quoted text -
>
> - Show quoted text
The imports are the standard ones for a servlet.
I will post the code in the morning for you to review.
|
| |
|
| |
 |
Jason.Herald@gmail.com

|
Posted: 2008-2-14 9:04:00 |
Top |
java-programmer >> Memory issue
On Feb 13, 5:16爌m, none <""mrloyal\"@(none)"> wrote:
> email***@***.com wrote:
> > I am 爃aving an issue where a struts based application continually
> > uses more and more ram. 營 get the available memory on each pass and
> > manually call gc which has slowed the issue but not fixed it.
>
> > I.e:
> > ??public ActionForward view (ActionMapping mapping,
> > ????????????????燗ctionForm form,
> > ????????????????燞ttpServletRequest request,
> > ????????????????燞ttpServletResponse response) {
>
> > ????Session ses = new SessionManager().getSession();
>
> > ????Rooms rooms = new Rooms(ses);
> > ????Posts posts = new Posts(ses);
>
> > ????HttpSession session = request.getSession();
>
> > ????List room_list = rooms.find_all();
> > ????request.setAttribute("rooms", room_list);
>
> > ????List post_list = posts.full_set(new
> > Long(session.getAttribute("room_id").toString()));
> > ????request.setAttribute("posts", post_list);
>
> > ????rooms = null;
> > ????posts = null;
>
> > /* runtime variable r is declared above */
> > ????r.gc();
>
> > ????return mapping.findForward("done");
>
> > ??}
>
> > The memory usage follows this pattern:
>
> > Pass 1: (before gc) 231.4797 (after gc) 242.2315
> > Pass 2: (before gc) 232.2050 (after gc) 241.6035
> > Pass 3: (before gc) 231.8197 (after gc) 241.2478
>
> > JVM is started using (although I have tried many different
> > combinations of the arguments):
>
> > -server -XX:+CMSClassUnloadingEnabled -XX:PermSize=128M -
> > XX:MaxPermSize=128M -Xconcurrentio -XX:+UseConcMarkSweepGC -
> > XX:NewRatio=30 -XX:+UseParNewGC -XX:NewSize=8m -XX:MaxNewSize=8m -
> > Xms256m -Xmx256m -XX:MinHeapFreeRatio=70 -XX:MaxHeapFreeRatio=90
>
> > Any ideas would be greatly appreciated and if you want to see any of
> > the other files let me know.
>
> > Thanks in advance!
>
> > Jason
>
> it's hard to say without the list of imports and without the code of the
> beans Room and Post.
> by the way the before gc value deos not seem to grow...- Hide quoted text -
>
> - Show quoted text -
It does shrink over time.
Before my original changes it took about 3 minutes to get to an out of
memory exception.
|
| |
|
| |
 |
Jason.Herald@gmail.com

|
Posted: 2008-2-14 21:01:00 |
Top |
java-programmer >> Memory issue
On Feb 13, 5:54 pm, Mark Space <email***@***.com> wrote:
> email***@***.com wrote:
> > Pass 1: (before gc) 231.4797 (after gc) 242.2315
> > Pass 2: (before gc) 232.2050 (after gc) 241.6035
> > Pass 3: (before gc) 231.8197 (after gc) 241.2478
>
> First pass, memory went up. First time you use this object more memory
> is needed. Second and third pass, memory use went down. So I don't see
> that memory is increasing here. I don't think there are any errors in
> the program.
>
> Let this app run for a long time. Monitor it. Is it actually
> increasing in memory use over the long haul? Do objects eventually time
> out and get released and memory reclaimed? (Make sure your session
> objects all time out.) Does the GC continue to run with increasing
> frequency and less results? Do you eventually get an Out of Memory Error?
>
> Need more info here. Looks ok to me.
>
> Look up some debugging info for Java, especially JMX. Use that. Get
> rid of the gratuitous call to the GC, it isn't needed.
I will post more passes (fyi the number is the current available
memory so it is going to go down).
If I let the app run for 20 minutes it runs out of memory.
And no there are no errors aside from the java.lang.OutofMemory
|
| |
|
| |
 |
Lew

|
Posted: 2008-2-14 21:37:00 |
Top |
java-programmer >> Memory issue
email***@***.com wrote:
> I will post more passes (fyi the number is the current available
> memory so it is going to go down).
>
> If I let the app run for 20 minutes it runs out of memory.
>
> And no there are no errors aside from the java.lang.OutofMemory
Usually when one doesn't post an entire example
<http://www.physci.org/codes/sscce.html>
the problem turns out to be in the code not shown. Complete examples allow
for valid answers to your question.
Make sure that you do not multipost when you provide the example.
--
Lew
|
| |
|
| |
 |
Mark Space

|
Posted: 2008-2-15 0:35:00 |
Top |
java-programmer >> Memory issue
email***@***.com wrote:
>
> I will post more passes (fyi the number is the current available
> memory so it is going to go down).
>
> If I let the app run for 20 minutes it runs out of memory.
>
> And no there are no errors aside from the java.lang.OutofMemory
Well at least 20 minutes is relatively quickly. Unfortunately after you
attach a debugger 20 minutes might turn into 20,000 minutes. I think
you'll need to try anyway. Get a debugger or other performance tool,
attach it and let the process run. Collect GC info so you can see what
objects are surviving GC. (They'll have their generation number
increasing.) That should at least get you pointed at the right part of
the code.
Here's an older reference, I didn't have time to look extensively for
the latest info:
<http://www.ibm.com/developerworks/library/j-perf06304/>
It will at least get you some key words to search for and get a debugger
running in your environment. I think that's the first step. Until you
have some clue where the error really is, posting code is unlikely to
produce a resolution. And knowing how to attach tools and profile your
code is a useful skill.
|
| |
|
| |
 |
| |
 |
Index ‹ java-programmer |
- Next
- 1
- JSP upload - detecting file type by mime type? what is application/octet-stream?I'm uploading a file via servlets or JSP, using the O'Reilly
MultipartWrapper, and was hoping that to be able to determine the file
type (eg. Excel spreadsheet, Word document, Powerpoint, PDF) depending
on the Mime Type.
Simple enough using the O'Reilly servlet package ~
<%@ page import="com.oreilly.servlet.*" %>
<%
if (request instanceof MultipartWrapper) {
try {
// Cast the request to a MultipartWrapper
MultipartWrapper multi = (MultipartWrapper)request;
// The file upload field on the submitting form is called
'upfile'.
String mimeType = multi.getContentType("resourcefile");
...
%>
Strange thing though is that I'm not getting the expected Mime Type.
For example, I just uploaded a Microsoft Word document and the
mimeType String is "application/octet-stream" instead of the expected
"application/msword".
However, uploading Excel spreadsheets and PDF files provided the
expected results of "application/vnd.ms-excel" and "application/pdf".
(see http://www.bc.edu/bc_org/tvp/email/helpers.shtml or
http://www.yolinux.com/TUTORIALS/LinuxTutorialMimeTypesAndApplications.html
for lists of mime types)
So, does anybody know why the Microsoft Word documents send the wrong
mime type ? Should I instead just use the file extension to determine
file type perhaps ?
Thanks in advance,
Stephen
- 2
- A constructive debate: Eclipse or NetBeans?On Mon, 15 Oct 2007, Jon Harrop wrote:
> > Anyway, I agree partially that Eclipse workspace creation should be
> > easier. I even filed a bug about the fact that you cannot create a fully
> > working workspace programmatically and then just use it. Eclipse writes a
> > lot of workspace-specific caches that don't work even inside the same
> > workstation, let alone after porting them to another user. (And it's even
> > an error to call them caches if Eclipse won't invalidate them when they
> > are outdated.)
>
> Ugh. Just me trying it here for the time being though. :-)
I didn't quite understand. Let me clarify what I said, just in case you
thought I was talking about something people do every day with Eclipse:
I meant it's virtually impossible to create a _whole_ workspace (with
Eclipse, plugins, projects, settings, just press play on tape...)
programmatically. Individual project settings (and a lot of them) can be
commited to version control and many typical settings work out of the box
after checking them out.
> I'll give it a go. I've read a lot of conflicting advice about installing
> libraries though. A lot of people say just copy the .jar's
> into .../jre/lib/ext/ and the .so's into .../jre/lib/amd64/ but the
> official documentation warns against this for non-specific reasons. In the
> end, I ignored the advice of the official JOGL docs and installed it by
> hand. Compiling and running JOGL demos is easier now but most of them still
> don't work.
I have never written anything under the jre/jdk directory. The whole
thought of stabbing installed software makes me feel sick :)
Fortunately, I don't think there's ever any need for that, either.
- Ville Oikarinen
- 3
- US-CA: San Rafael, Full time Java-PL/SQL programmer.Working as a team member of the I.S. group, develops, integrates, and
supports applications.
Primary Responsibilities:
* Conversion of Servlets/JSP to Swing based applications.
* Converting logic from procedures/packages in Oracle to Java.
* Maintenance of code.
* User training/support.
* Ability to work on multiple projects simultaneously.
* Research, evaluate, and implement new 3rd party software packages.
Requirements:
* 2-3 years industry level experience in the following Java
technologies: Swing, JSP, Servlet, JDBC, RMI, EJB.
* 1-2 years industry level experience in Oracle 8i (or greater) which
includes writing PL/SQL procedures, packages and triggers.
Position Type:
* Full Time.
Company Location:
* San Rafael, California, USA.
Restrictions:
* This is not an entry level position.
* No thrird party companies.
* Sorry No H1Bs visa holders.
Email resume to is0871 at gmail.com
- 4
- reading a skingle key without pressing ENTER afterDenis wrote:
> Maybe I could write my own read() function
> deal with all backspace pressed etc...
>
> How do I read then a single key in Java?
> So it'll get just one keystroke and return key value
> without presing ENTER ?
You can't - that's the source of the problem and where
all attempts at a solution will fail.
- 5
- Waiting For A Synchronized MethodSay thread1 begins executing a synchronized method.
While it's executing, both thread2 and thread3 call the synchronized
method, in that order.
When thread1 ends executing and gives up its lock, is thread2
guaranteed to execute next (because it's been waiting longer than
thread3), or is it possible that thread3 executes first?
My experiments seem to point to thread2 always running first in the
above situation, but I'd like to verify this.
Thanks,
John
- 6
- Looking for Feedback on New Project - ChaiDBHi,
I'm one of the developers working on a new project: ChaiDB.
I am trying to get feedback on it, and looking to see if there might
be a good fit for your projects. We're currently exploring ways we
can add functionality to ChaiDB such as an indexing mechanism for
caching web data. I would appreciate any feedback/advice I could get
from this group and if you are interested, you can find details at
http://chaidb.sourceforge.net Below is a brief description of the
project.
ChaiDB is an embedded database developed at the kernel level using
Java and B-Tree implementation for data storage. It's very simple to
use without any administrative overhead for high performance read/
write operations. It provides Java, JCA, JTA interfaces and database
administration tools such as backup and restore, etc. ChaiDB is ideal
for applications utilizing caching, archiving, queuing and buffering
capabilities.
Thanks,
Jim
- 7
- Changing the value of Boolean?Sure I've read somewhere (but can't find it now) that you cannot change the
value of a Boolean tyep variable. You have to set it each time like this -
////////////////////////////////////////////////////////////
Boolean b = new Boolean(true);
b = new Boolean(false);
////////////////////////////////////////////////////////////
Is this correct?
thanks
harry
- 8
- Static class - one per JVM or one per app?I have a class called MyClass that contains a static variable (myVar).
I have two J2EE apps running on WebSphere under the same JVM,
MyFirstApp and MySecondApp. From MyFirstApp i set the value of myVar by
doing MyClass.setMyVar(3).
....what will be the value of MyClass.getMyVar() when run from
MySecondApp?
ie - will the static var have scope across the whole JVM or just the
web app?
Thanks
David Bevan
http://www.davidbevan.co.uk
- 9
- 10
- Recommend a good programming environment for beginner?Howdy. I'm taking a java class, and they unfortunately just have us
using the DOS cmd liine and notepad to program. I'd like to use a good
environment. I used to use Codewarrior. Netbeans came with the Java
download from Sun, but it overwhelmed me, seems like I'd have to invest
a lot in learning it. Does anybody know of a sleeker, easier to get
used to environment?
Alternatively, anyone know of a good, simple, easy to follow tutorial
to get one up an running in netbeans?
Thanks a heap....
Bill J.
- 11
- Multiline JLabelHi, I want to use a JLabel but I want it to be shown in several lines.
Otherwise the JDialog is very very wide when the text is long.
How can I do that?
- 12
- array initilization and memory usageI'm a little new here, so please bear with me if this sounds like a
goofy
question!...
let's say that I have an class with 15 or so members, each taking up a
fair
amount of space - we'll call this class bars
If I create an array of 400 empty bars objects, but only instantiate
the
first five or so then am I still setting aside the memory for the other
395?
I hope that made sense!
Thanks
- 13
- Ant multi OS <exec> adviceHi,
I have the following Ant code which I would like to also use on Linux:
<target name="build.XmlJaxb">
<exec dir="${checkout.dest}/XmlJaxb" executable="cmd">
<arg line="/C ant -logger org.apache.tools.ant.XmlLogger
-logfile ant_log_dist.xml dist" />
</exec>
</target>
For Linux I woul dneed to replace "cmd" and "/C" with "bash" or something?
I know there is the <exec> OS option but then I would need to copy the
<exec> tags with a Windows and Linux version. Gives maintenance errors.
I know I could make variables for "cmd" and "/C" and use the <if>
contrib to look at the os Java system property.
I cannot use <ant> task because I do not seem to be able to specify the
Xml logger and the output file.
any ideas?
thanks,
Peter
- 14
- Creme 3.27 and AWT framesHi!
I working on a problem. We have an application in which a signature can
be captured. This works perfectly on a PDA (Windows CE, Creme 3.25) but
since the upgrade to Windows CE Second Edtion, Creme 3.27 it fails to
work.
The problem is, the created frame will not be shown after the
frame.show() method. It looks like this thread is killed because the
code after the frame.show() isnt executed.
The (partial) code:
frame = new Frame();
frame.setBackground(Color.white);
frame.setSize(dimension);
saveButton.setLabel("Save");
saveButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(ActionEvent e)
{
saveButton_actionPerformed(e);
}
});
frame.add(saveButton, BorderLayout.NORTH);
clearButton.setLabel("Clear");
clearButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(ActionEvent e)
{
clearButton_actionPerformed(e);
}
});
frame.add(clearButton, BorderLayout.SOUTH);
frame.show();
frame.addMouseMotionListener(this);
frame.addMouseListener(this);
frame.addWindowListener(this);
}
//////////////////
frame.pack() before frame.show() doesnt help, frame.setVisible(true)
instead of frame.show() doesnt help. Anyone an idea ?
- 15
- Webservice from a servletHi,
I have an existing application uses Servlets and hosted on Websphere6.
Now we have a requirement to meke the same functions which we have in
JSPs and Servlets existing as Webservices.
Can any one have idea how to achieve this.
At this movement what i am looking is atleast how to use the existing
servlet as a webservice? A Simple example.
Thanks for the help in advance.
regards,
Ravi
|
|
|