Why do I get this Out of memory, how can I prevent it?

Hello
I have an annoying problem that never has occured before....
I use JSP with Beans, I know that the problem lies in my method "setIntotable()"
because its just that method that is called in current JSP-page when I get this Out of Memory error.
All information regarding matches+players are stored in a mysql-database
When I'm about to summerize everything and create a new "table" with fresh data+ranking I get this Out of memory error. I havent made any changes so I think its strange that I suddenly get this error. Below is my syntax:
......................syntax for method "setIntotable()".........................................
public void setIntotable(){
int noOfRows;
String fnamn1 = "";
String enamn1 = "";
String fnamn2 = "";
String enamn2 = "";
Vector matcher = new Vector();
matcher = readTider();
Vector players = getPlayers();
Player player1 = new Player();
Player player2 = new Player();
try {
Connection con2 = DriverManager.getConnection(fileURL, "", "");
Statement u = con2.createStatement();
String s = "TRUNCATE TABLE totaltiddiv";
u.execute(s);
u.close();
con2.close();
int q = 1;
Connection con = DriverManager.getConnection(fileURL, "", "");
Statement updateStatement = con.createStatement();
for (int i = 0; i < matcher.size(); i++) { //matcher  has a 200<size
Totaltid t = (Totaltid) matcher.elementAt(i); //Se below which parameters Totaltiddiv has
String query1 = "INSERT INTO totaltiddiv VALUES('" + t.tidnr + "','" +
t.tidnrinv + "','" + q + "','" + t.bana + "','" + t.tid + "','" +
t.datum + "','" + Integer.toString(Integer.parseInt(t.division)) +
"','" + t.matchindex + "','" + Integer.parseInt(t.division) + "','" +
0 + "','" + "','','" + "','" + "','','" + "','" + "','" + "div" +
Integer.toString(Integer.parseInt(t.division)) + "rank" +
t.matchindex.substring(0, 1) + "','" + "div" +
Integer.toString(Integer.parseInt(t.division)) + "rank" +
t.matchindex.substring(1, 2) + "','" + "','" + "','" + "','" +
"','" + "','" + "','" + "','" + "','" + "','" + "','" + "')";
noOfRows = updateStatement.executeUpdate(query1);
q++;
updateStatement.close();
Statement selectStatement = con.createStatement();
for (int i = 0; i < matcher.size(); i++) {
Totaltid t = (Totaltid) matcher.elementAt(i);
String query2 = "SELECT * FROM playerdiv WHERE totalkey='" + t.p1key +
ResultSet rs2 = selectStatement.executeQuery(query2);
while (rs2.next()) {
fnamn1 = rs2.getString("fnamn");
enamn1 = rs2.getString("enamn");
rs2.close();
String query3 = "SELECT * FROM playerdiv WHERE totalkey='" + t.p2key +
ResultSet rs3 = selectStatement.executeQuery(query3);
while (rs3.next()) {
fnamn2 = rs3.getString("fnamn");
enamn2 = rs3.getString("enamn");
rs3.close();
selectStatement.close();
String update = "UPDATE totaltiddiv SET p1fnamn='" + fnamn1 +
"', p1enamn='" + enamn1 + "', p2fnamn='" + fnamn2 + "', p2enamn='" +
enamn2 + "' WHERE p1key='" + t.p1key + "' AND p2key='" + t.p2key +
System.out.println(update);
noOfRows = updateStatement.executeUpdate(update);
updateStatement.close();
con.close();
catch (SQLException sqe) {
System.out.println(sqe);
------------------------------Tottaltiddiv-----------------------------------------------
public String tidnr;
public String tidnrinv;
public String idnr;
public int bana;
public String tid;
public String datum;
public String division;
public String matchindex;
public int tiddiv;
public boolean ledig;
public int rank;
public String p1fnamn;
public String p1enamn;
public String p2fnamn;
public String p2enamn;
public String p1key;
public String p2key;
public int set11;
public int set12;
public int set21;
public int set22;
public int tie1;
public int tie2;
public boolean wo1;
public boolean wo2;
public boolean spelad;
public String wonevenloss;
public int diff;
Every parameter above is in range of 1-50 charachters
I cant see what should bee "eating" all the memory?
Would be very glad if anyone could help me.....
Thanks in advance /D_S

That's some ugly procedural code you've written there. What is this, VB?
Well-decomposed code would say write short methods that each do one thing well.
If I were you, I'd decompose this method into several and test each one individually.
One advantage of this will be narrower scope. The garbage collector will have a chance to clean up some of your mess that way.
I don't know what all those declared variables at the bottom are about. Are those class members or something? Why are they all public?
Please don't tell me this is scriptlet code in a JSP...
%

Similar Messages

  • Prior saved .pdf sometimes has blacked out content. How can I prevent this?

    I use Mac OS 9 Maverick, read email in Mail.app and Yahoo.Mail, switch between Safari and Firefox for browsing (because Safari does not allow Flash videos to appear on pages).  When I want to save an email or an html file or report as .pdf, I use Command-P and select Save As PDF from the Print popup.  Normally, I can go back years later and read the .pdf document in the Home File I filed it in using Adobe Reader.  Sometimes, however, when I open a .pdf file--and I cannot tell prior to opening it--all of the content has been blacked out.  It is as if someone redacted the document after filing it, which I don't do. 
    How can I prevent these redactions?  The content being blacked out varies from extremely personal and important health files to simple email correspondence I want to save.  Sometimes I have paid for a document and have to contact the publisher to send hard copy via USPS due to this problem.
    What am I missing here?  Do I need a specific plug-in?  Is there a way to retrieve the blacked-out content from my computer stored file?
    Peter

    This forum is only for discussions on the forums themselves. You should post your question in the apropriate product forum,
    http://forums.adobe.com/community/shockwave
    if your ptoblem is with Shockwave, or
    http://forums.adobe.com/community/flashplayer
    if it affects Flash Player.

  • Why do I get this message "The application finder can't be opened 10810

    My finder will not open and when I click on finder I get the message The application finder can't be opened 10810.

    click here for information.

  • Premiere Elements 7 OUT OF MEMORY - how to get more????

    Hello all, I have a MAJOR problem. I know i am running on an old program - premiere elements 7. But I assume that all premiere elements versions do this. I made this video for my sister in law for her bridal shower. It's complete, but when i go to export it will not work. I have tried everything. It now says "System low on memory, please save your project and proceed with caution" All I want to do is export this so I can play this video for the bridal shower (in 2 days!!!)
    I am not a computer wiz whatsoever. Can anyone out there dummy this down and help me get more memory? Or ANY suggestions just so I can export this to play this at the bridal shower?
    I went to all the adobe files in my computer and deleted everything in there. That didn't help. I have plenty of space on my actual computer, but I don't know how to tell this to use that space! I think the problem is the video I am using is HD. The video is 25 minutes.
    ANY HELP??
    thank you!!

    cmferg
    Just a mention...."memory" as it relates to computer can include installed RAM (physical memory) as well as virtual memory (which is
    actually an allotment of hard drive space). There are detailed articles on the subject which seem to get more complex the deeper you go into the subject.
    Although most Out of Memory messages relate to installed RAM, it can also relate to hard drive space under certain extreme conditions.
    And, there are instances where the particular video format has been associated with getting those low memory messages. Computer can have memory "leaks". And so on. References can be supplied if needed.
    And, if you have a 32 bit computer, only 4 GB of installed RAM are supported. So, the reason for the starter question...how much RAM installed? And, if less than 4 GB, how many computer slots does your computer motherboard have to add more to bring the total installed RAM to 4 GB?
    So, please supply the starter information (as requested in post 1) so that we can sort in or out factors related to your "Out Of Memory" from your Premiere Elements 7 (32 bit application) project
    a. installed RAM, available RAM
    b. free hard drive space
    c. format and duration of video source on Timeline...you say HD and 25 minutes duration....do you know the video compression and file extension or brand/model/settings of the camera that recorded the video?
    d. when are you getting this "Out of Memory" message - while you are still in the Edit area or after you hit Share/ and try to make
    your export choice?. What is your intended export under Share?
    We are eager for you to succeed and as quickly as possible to meet your schedule.
    Again, any questions or need clarification, please do not hesitate to ask.
    Thank you.
    ATR

  • Why do I get this error message when I open Organizer in Photoshop Elements 11 "Elements Organizer has stopped working"? My only option is to Close Program so I am effectively locked out of my photo catalogue.  I have reinstalled the program to no avail.

    Why do I get this error message when I open Organizer in Photoshop Elements 11 "Elements Organizer has stopped working"? My only option is to Close Program so I am effectively locked out of my photo catalogue. I have tried reinstalling the program but it made no difference to the error message.
    Could someone help please?  Steph

    Hi,
    Please give a try to Photoshop Elements (PSE) knowledge base. steps mentioned on this and see if it works.
    Regards
    Kishan

  • Getting an Out of memory exception while validating XML against XSD

    Hello friends,
    I am getting an Out Of Memory exception while validating my XML against a given XSd which is huge.
    SAXParserFactory saxParserFactory = SAXParserFactory.newInstance();
            saxParserFactory.setValidating(true);
              SAXParser saxParser = saxParserFactory.newSAXParser();
             saxParser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaLanguage", "http://www.w3.org/2001/XMLSchema");
             saxParser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaSource",new File("C:/todelxsd.xsd")); as u may see the darkened code. this basically Loads the XSD in Memmory , and JVM throws an out of Memory exception. is there any other way round of validating an XML against an XSD where i dont have to load my XSD if not then kindly let me know the solution for above problem .
    Thanks.

    Yes, but increasing the heap size is a temporary solution , isnt there a way where the XML can be validated against an XSD without having to load XSD in memory

  • Getting an out of memory exception while validating my XML against a XSD

    Hello friends,
    I have asked this question in following thread too. Pasting it again here just to saye your time
    http://forum.java.sun.com/thread.jspa?threadID=690812&tstart=0
    I am getting an Out Of Memory exception while validating my XML against a given XSd which is huge.
    SAXParserFactory saxParserFactory = SAXParserFactory.newInstance();
            saxParserFactory.setValidating(true);
              SAXParser saxParser = saxParserFactory.newSAXParser();
             saxParser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaLanguage", "http://www.w3.org/2001/XMLSchema");
             saxParser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaSource",new File("C:/todelxsd.xsd")); as u may see the darkened code. this basically Loads the XSD in Memmory , and JVM throws an out of Memory exception. is there any other way round of validating an XML against an XSD where i dont have to load my XSD if not then kindly let me know the solution for above problem .
    Thanks.

    Yes, but increasing the heap size is a temporary solution , isnt there a way where the XML can be validated against an XSD without having to load XSD in memory

  • According to my network provider (Amaysim/Optus) Tethering is enabled, so why do I get this error message "to enable personal hotspot on this account, contact OPTUS"

    According to my network provider (Amaysim/Optus) Tethering is enabled, so why do I get this error message "to enable personal hotspot on this account, contact OPTUS"
    Amysim/Optus support can not help.
    I can not check or change any network settings (no APN settings)
    I have synced phone using latest itunes (10.5.3).
    Phone software is up to date (5.0.1).
    Network settings have been reset.
    SIM card has been taken out and put back in.
    Phone has been switched off/on again.
    Another sim card from virgin works ok (hotspot option is visible and can be turned on/off as required)
    The Amaysim/Optus SIM card can be put into another phone (android) and tethering/hotspot works fine.
    Can anyone provide solution to this nightmare?

    I am having the same issue although i have an iphone 5. I have contacted Live connected numerous times an tried everything imaginable to solve the issue. Is it possibly a handset issue? I cant recieve any help from optus as im with live connected, they cant help me and apple keep telling me to contact your carrier ( live connected). Seems to make me want to switch providers pretty shortly..
    please let me know if you can solve your issue and maybe it can help me too..

  • Why am I getting this error?

    Hello,
    I am trying to call my Java class from a JSP page. I am getting this error:
    Generated servlet error:
    C:\Program Files\Apache Tomcat 4.0\work\Standalone\localhost\em\jsp\Test_0005fSummarySBU_0005fscreen$jsp.java:82: Wrong number of arguments in constructor.
    strQuery=new ListReturn(strEssUser, strProcessingMonth, strProcessingYear);
    I don't understand why I am getting this error as I pass three paramters to the Java class, and I accept three parameters in the constructor.
    JSP:
    <!-- META TAG is necessary to ensure page recompiles--------------->
    <META Http-Equiv="Expires" Content="0">
    <META Http-Equiv="Pragma" Content="no-cache">
    <HTML>
    <!-- The two Java Classes used to build the AlphaBlox query -->
    <%@ page import="com.home.tool.reporting.*" %>
    <%@ page errorPage="run_error.jsp" %>
    <%@ page import="java.util.List,
                     java.util.Collection,
                java.net.URLDecoder" %>
    <HEAD>
    <META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
    <TITLE>Economic Model - Summary SBU Report</TITLE>
    <!--Run the onload here, re-retrieve params BM and Breport, pass to onload---------->
    <BODY bgcolor=#ffffff>
    <%
                    Collection strQuery = null;
                    String strEssUser = "test";
                    String strProcessingMonth = "JUL";
                    String strProcessingYear = "2002";
                    strQuery=new ListReturn(strEssUser, strProcessingMonth, strProcessingYear);
                    System.out.println(strQuery);
    %>
    </BODY>
    </HTML>Java class:
    package com.home.tool.reporting;
    import java.net.URL;
    import java.sql.*;
    import java.io.*;
    import java.util.*;
    public class ListReturn extends ReportQueryBuilder
            public void ListReturn()
            public Collection ListReturn(String userID, String pMonth, String pYear)
                throws ReportQueryBuilderException
                //declare Collection store Value-Object pairs
                Collection c = new ArrayList();
                //declare and initialize variables
                CallableStatement cs = null;
                ResultSet rs = null;
                // declare call for stored procedure to pass in three parameters
                String pass = "{Call dbo.p_rep_srSbuList(?, ?, ?)}";
                try
                    //open CallableStatement using JDBC connection to SQL database
                    cs = con.prepareCall(pass);
                    //set IN parameters
                    cs.setString(1, userID);
                    cs.setString(2, pMonth);
                    cs.setString(3, pYear);
                    //execute call and return result set
                    rs = cs.executeQuery();
                    //loop through result set storing each record as a Value-Object pair
                    while(rs.next())
                        c.add(new ListBoxValueObjects(rs.getString(1), rs.getString(2)));
                catch (SQLException sqle)
              throw new ReportQueryBuilderException(replaceToken("Problems executing query: "+sqle.getMessage(), "'", "\\'"));
                finally
                    try
                        //close the Result Set and CallableStatement
                        rs.close();
                        cs.close();
                    catch(Exception e)
                        System.out.print("\nFATAL   : " + e);
                        System.out.print("\nFATAL   : " + e);
                return c;
    }Does anyone see whay I am getting this error??
    I can't figure out the problem!

    change this:
    <%
         Collection strQuery = null;
         String strEssUser = "test";
         String strProcessingMonth = "JUL";
         String strProcessingYear = "2002";
         strQuery=new ListReturn(strEssUser, strProcessingMonth, strProcessingYear);
         System.out.println(strQuery);
    %>To this:
    <%
         Collection strQuery=null;
         String strEssUser="test";
         String strProcessingMonth="JUL";
         String strProcessingYear="2002";
         lr=new ListReturn(strEssUser, strProcessingMonth, strProcessingYear);
         System.out.println(lr.getQuery())
    %>Then make a new public method in your Java called getQuery()
    public Collection getQuery();Do what you need to do to process it and return the value in getQuery. You will also probably need to make private variables in you declaration to do the processing on.

  • Why did I get this stupid emails about missing payment of my Adobe CC ???

    Hi, I have get this email from Adobe:
    what we have here payment for your account could not be loaded. So there will be no interruptions in your use of the Creative Cloud , please update your billing information shortly .
    account Management
    If you have decided not to renew your subscription , no further action is required on your part. You have until the end of the current billing period unlimited access to your Creative Cloud membership. Then your paid membership in a free Creative Cloud membership is converted . If you use this time more than 2 GB Creative Cloud storage , you may not be able to access some of your files . In this case it is recommended to delete some files, so you are below the memory limit of 2 GB , which is included in a free Creative Cloud membership.
    If you change your mind , we are always happy to activate your paid subscription again .
    Thank you for your confidence.
    The Creative Cloud Team
    Why did I get this stupid email, because my banking dates are the same as before and creditcard is everytime paying ??????? So what's going on?

    Hi.  I checked on the order and it says the order is currently being processed and I should check back tomorrow. I'm mostly just concerned because I got an email saying the order was on hold, and I want to make sure it actually does go through and I'm not just waiting for a delivery that's not going to come. I'm still confused as to why I'd get an email saying I had to call the fraud department only to be told I shouldn't have called the fraud department.

  • HT1414 Why do I get 'This message has no content' with some e-mails on my iPad when the same messages can be received on my MacBook Pro without any problem, and how can I fix it?

    Why do I get - 'This message has no content' - with some e-mails on my iPad when the same messages can be received on my Mac Book Pro without any problem and how can I fix it?

    Is this a POP (POP3) email account?  If so, you MacBook Pro may be retrieving the email and deleting it off the server before your phone can.  Another possibility is that both your Mac and your phone are trying to retrieving it at the same time, and the POP server, which will only allow a single email client connection at a time, is locking out your phone resulting in the "has not been downloaded from the server" error.

  • Hello, why am i getting this message? Photoshop cannot initialize because of a program error.

    Hello, why am i getting this message? Photoshop cannot initialize because of a program error.

    OK. Sorry about the lack of info...
    I have a creative cloud account. I have three computers. I have no problems going from home to work and using the same account. Occasionally i have to deactivate the cloud on one computer to use the other. Lately. even though other cloud software
    is working, photoshop isn't, and the message i'm getting is that it can't initialize. I've tried reinstalling it numerous times and still it won't launch. Photoshop CC. I have a g5 tower running OS 10.7.5. with 2 gig os memory. My hard disk is 1 year old.

  • I have been trying to work on my homework all afternoon, via NAU's blackboard system. I am continuously getting booted out of the system, with an error stating "Data execution prevention". How can I prevent this from continuing?

    I have been trying to work on my homework all afternoon, via NAU's blackboard system. I am continuously getting booted out of the system, with an error stating "Data execution prevention". How can I prevent this from continuing?

    If you are wondering why you are not getting any responses, it is because you have vented a complaint without any details that make any sense or give anyone something to work on.
    If you want help, I suggest actually detailing what has happened, with versions of software etc. Anything that would let us assist.
    As a start I am guessing that you have not really got the hang of "How it all works". Firstly download the Pages09_UserGuide.pdf from under the Help menu. Read that and view the Video Tutorials in the same place. A good addition would be the iWork 09 Missing manual book and something to help you learn how to use your Mac.
    If there are specific tasks you need help with:
    http://www.freeforum101.com/iworktipsntrick/index.php?mforum=iworktipsntrick
    Is a good resource.
    Peter

  • On loading Firefox, I get message that I don't have updated version, but I do. 7.0.1 Why do I get this?

    Also, not related: I keep getting an automatic download saying "service provider 22.jsp" - once I downloaded it, and got multiple blank pages. Now I just delete it, but why am I getting this?
    [email protected]

    Hi Dadwpr,
    Here is a link from Microsoft on how to  run the Memory Diagnostics Tool.
    http://windows.microsoft.com/en-US/windows7/Diagnosing-memory-problems-on-your-computer
    Also I was wondering if you have changed the dpi of the scan and if you have tried a different folder to scan to?
    Click on how to scan with Hp software, it will give you how to check scan settings.
    http://h10025.www1.hp.com/ewfrf/wc/document?docname=c03476857&cc=us&dlc=en&lc=en&jumpid=reg_r1002_us...
    Please feel free to contact me if you have other questions
    Thank you 
    Please click “Accept as Solution ” if you feel my post solved your issue, it will help others find the solution.
    Click the “Kudos, Thumbs Up" on the bottom to say “Thanks” for helping!

  • TS1702 "The feature you are trying to use is on a network resource that is unabailable" Why am I getting this message when I try to updaate itunes or quicktime?

    The feature you are trying to use is on a network resource that is unabailable" Why am I getting this message when I try to updaate itunes or quicktime?

    Before trying the update again, use Microsoft's Fix it solution at http://support.microsoft.com/mats/Program_Install_and_Uninstall. Use it to uninstall iTunes and Quicktime. It bypasses this not uncommon problem. When the solution finishes, the selected program will be uninstalled. It can take several minutes and I have seen as much as half an hour.
    After iTunes & Quicktime are uninstalled, try the update again.

Maybe you are looking for

  • Making changes in DME File TCode F111

    Hi Friends, I have to make changes in DME file in Transaction F111. Friend please help with some user exit or event module with some some info. Thanks in Advance, Best Regards

  • Copy and paste from InDesign CS2 to Illustrator CS3

    Hi, I'm a Mac Illustrator CS3 user and having trouble copying text from InDesign CS2 to Illustrator CS3. After copy text from InDesign (allowed), I'll go to Illustrator to paste it, but none of the text appear. I'm not sure if there any other step sh

  • How do I get rid of an Internal Domain error 1015 on my Mac

    Using IGG iBank software the Internal Domain error 1015 keeps popping up. How can I get rid of that?

  • SWFLoader issue... IMPORTANT & URGENT

    I m developing an AIR application to run different SWF Clips using SWFLoader. I have given a list of clips in tree-view. The problem is that when i play first clip (any clip from the list) that runs fine with audio and video but when i play anyother

  • Ipod touch os4.2 working with Airport Express

    hi, need some help!!! Trying to connect ipod touch with os4.2 to airport express. when i go to use airtunes by clicking on the icon to the right of the play funtions, my touch sees my apple tv but fails to see my airport express. I have managed to co