Large Pdf using XML XSL - Out of Memory Error

Hi Friends.
I am trying to generate a PDF from XML, XSL and FO in java. It works fine if the PDF to be generated is small.
But if the PDF to be generated is big, then it throws "Out of Memory" error. Can some one please give me some pointers about the possible reasons for this errors. Thanks for your help.
RM
Code:
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import org.xml.sax.InputSource;
import org.xml.sax.XMLReader;
import org.apache.fop.apps.Driver;
import org.apache.fop.apps.Version;
import org.apache.fop.apps.XSLTInputHandler;
import org.apache.fop.messaging.MessageHandler;
import org.apache.avalon.framework.logger.ConsoleLogger;
import org.apache.avalon.framework.logger.Logger;
public class PdfServlet extends HttpServlet {
public static final String FO_REQUEST_PARAM = "fo";
public static final String XML_REQUEST_PARAM = "xml";
public static final String XSL_REQUEST_PARAM = "xsl";
Logger log = null;
     Com_BUtil myBu = new Com_BUtil();
public void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException {
if(log == null) {
     log = new ConsoleLogger(ConsoleLogger.LEVEL_WARN);
     MessageHandler.setScreenLogger(log);
try {
String foParam = request.getParameter(FO_REQUEST_PARAM);
String xmlParam = myBu.getConfigVal("filePath") +"/"+request.getParameter(XML_REQUEST_PARAM);
String xslParam = myBu.SERVERROOT + "/jsp/servlet/"+request.getParameter(XSL_REQUEST_PARAM)+".xsl";
     if((xmlParam != null) && (xslParam != null)) {
XSLTInputHandler input = new XSLTInputHandler(new File(xmlParam), new File(xslParam));
renderXML(input, response);
} else {
PrintWriter out = response.getWriter();
out.println("<html><head><title>Error</title></head>\n"+
"<body><h1>PdfServlet Error</h1><h3>No 'fo' "+
"request param given.</body></html>");
} catch (ServletException ex) {
throw ex;
catch (Exception ex) {
throw new ServletException(ex);
public void renderXML(XSLTInputHandler input,
HttpServletResponse response) throws ServletException {
try {
ByteArrayOutputStream out = new ByteArrayOutputStream();
response.setContentType("application/pdf");
Driver driver = new Driver();
driver.setLogger(log);
driver.setRenderer(Driver.RENDER_PDF);
driver.setOutputStream(out);
driver.render(input.getParser(), input.getInputSource());
byte[] content = out.toByteArray();
response.setContentLength(content.length);
response.getOutputStream().write(content);
response.getOutputStream().flush();
} catch (Exception ex) {
throw new ServletException(ex);
* creates a SAX parser, using the value of org.xml.sax.parser
* defaulting to org.apache.xerces.parsers.SAXParser
* @return the created SAX parser
static XMLReader createParser() throws ServletException {
String parserClassName = System.getProperty("org.xml.sax.parser");
if (parserClassName == null) {
parserClassName = "org.apache.xerces.parsers.SAXParser";
try {
return (XMLReader) Class.forName(
parserClassName).newInstance();
} catch (Exception e) {
throw new ServletException(e);

Hi,
I did try that initially. After executing the command I get this message.
C:\>java -Xms128M -Xmx256M
Usage: java [-options] class [args...]
(to execute a class)
or java -jar [-options] jarfile [args...]
(to execute a jar file)
where options include:
-cp -classpath <directories and zip/jar files separated by ;>
set search path for application classes and resources
-D<name>=<value>
set a system property
-verbose[:class|gc|jni]
enable verbose output
-version print product version and exit
-showversion print product version and continue
-? -help print this help message
-X print help on non-standard options
Thanks for your help.
RM

Similar Messages

  • Oracle XML CLOB out of memory error

    I am running several of Oracle's XML tools
    to store large XML documents in Oracle.
    I am successful with a 3 MB file, but not
    with a 20 MB file. I get an "out of memory"
    exception in LobPlsqlUtil.class.
    The CLOB is accessed through the method
    CLOB.getCharacterStream(), which is then
    handed off to an XMLParser class. The
    exact exception is below:
    Any ideas? Thanks, Rich
    ==========================================
    Unhandled exception breakpoint occurred at line 135 in file [D:\programs\jdev\jdbc\lib\oracle8.1.7\classes12.zip]\oracle\sql\LobPlsqlUtil.class: java.lang.OutOfMemoryError.
    ==============================

    I have some more information to add to the
    original post. I found that if I access the
    CLOB very fast then I can get all 20 MB of
    data from the CLOB. If I access it slowly
    (meaning that I pass CLOB.getCharacterStream
    to a parser) then it fails.
    I wrote my own InputStream as a wrapper
    around CLOB, using the CLOB.getChars()
    function. If I pass this input stream to
    a parser (one of Oracles, or Xerces) and
    get the data chunks on demand, it still
    fails. If, instead, I read all the CLOB
    data as fast as possible, and buffer it
    locally before passing it on to the parser,
    then I get all 20 MB. Go figure!!
    Also, when the CLOB reading fails, it doesn't
    help to get a new ResultSet, or to close and
    open a new Connection and try to start where
    it left off.

  • [N95 8GB]Out of Memory error when opening 15MB pdf...

    What is the file size limit when opening a pdf file? I have a 15MB pdf file that cause 'Out of memory' error when I opened it with the PDF Reader that comes with the phone.
    Thanks.

    Hi,
    It seems that problem is file specific, so could you please share a file with me. I sending you a private message.
    Regards,
    Anoop

  • Out of Memory error on some PDF's, not all PDF's.

    Hi there,
    I have read most of the posts in the forums that relate to 'Out of Memory' issues with PDF's and I have to say that there is still no solution that I have found.
    I have tried reinstalling Adobe Reader, Flash Player and tried clearing my Temp Files. None of these fixed the issue.
    The PDF's that receive this memory error are downloaded off a CMS website that has many offices and logins. Only one office is experiencing this out of memory issue so we know that it is not an issue with generating the PDF's on the CMS website, otherwise all the offices and logins would have this issue, since they use the same system.
    I am an admin of that CMS website and even I receive the same out of memory issue when I try and view the PDF's from that office, as the customer does.
    When we open these PDF's with another PDF reading program, the PDF's open fine. So that tells me that the issue lies with Adobe Reader and not the PDF file itself.
    These PDF files that are receiving the error about 1MB-4MB, so they are not large.
    Could you please tell me the solution to this out of memory error as we may lose a customer because your product is producing an error that does not seem to have been fixed after years of being reported by your customers.
    Thanks.

    As an Adobe Reader XI user, if I may put my two cents in, that "Out of Memory" problem is not with the Adobe Reader XI application, which was installed on our computers! I think, the problem is with how the PDF documents, which we were trying to open, were generated (or regenerated).
    I remember I was able to open my old credit card statement online without any problem and now I am not able to open the same old statement (out of memory) because it could have been regenerated! In fact, I could not open any of my credit card statements (old or new) on this specific credit card web site, which makes me believe those statments were regenerated or somthing with some new Adobe software.
    As others mentioned, even I'm able to view other PDF documents without any problem.

  • Out of Memory Error bcoz of xml file size

    Hi,
    Help me to solve this out of memory error, if xml file size
    is increased means
    it is not displaying anything and displaying this out of
    memory error.
    Thanking you
    Regards
    Nirmalatha.N

    You should avoid loading large sized XML files in your Flash
    Lite application. There is a limit on incoming data, and anything
    beyond that will give an error. My experience has been around 1000
    characters in a single stream of incoming text.
    A possible solution your memory problem is to use a middle
    language like PHP, ASP etc, to stream a single XML data file in
    parts to your Flash Lite application. This means you avoid loading
    XML directly in Flash.
    Mariam

  • Uploading large files from applet to servlet throws out of memory error

    I have a java applet that needs to upload files from a client machine
    to a web server using a servlet. the problem i am having is that in
    the current scheme, files larger than 17-20MB throw an out of memory
    error. is there any way we can get around this problem? i will post
    the client and server side code for reference.
    Client Side Code:
    import java.io.*;
    import java.net.*;
    // this class is a client that enables transfer of files from client
    // to server. This client connects to a servlet running on the server
    // and transmits the file.
    public class fileTransferClient
    private static final String FILENAME_HEADER = "fileName";
    private static final String FILELASTMOD_HEADER = "fileLastMod";
    // this method transfers the prescribed file to the server.
    // if the destination directory is "", it transfers the file to
    "d:\\".
    //11-21-02 Changes : This method now has a new parameter that
    references the item
    //that is being transferred in the import list.
    public static String transferFile(String srcFileName, String
    destFileName,
    String destDir, int itemID)
    if (destDir.equals(""))
    destDir = "E:\\FTP\\incoming\\";
    // get the fully qualified filename and the mere filename.
    String fqfn = srcFileName;
    String fname =
    fqfn.substring(fqfn.lastIndexOf(File.separator)+1);
    try
    //importTable importer = jbInit.getImportTable();
    // create the file to be uploaded and a connection to
    servlet.
    File fileToUpload = new File(fqfn);
    long fileSize = fileToUpload.length();
    // get last mod of this file.
    // The last mod is sent to the servlet as a header.
    long lastMod = fileToUpload.lastModified();
    String strLastMod = String.valueOf(lastMod);
    URL serverURL = new URL(webadminApplet.strServletURL);
    URLConnection serverCon = serverURL.openConnection();
    // a bunch of connection setup related things.
    serverCon.setDoInput(true);
    serverCon.setDoOutput(true);
    // Don't use a cached version of URL connection.
    serverCon.setUseCaches (false);
    serverCon.setDefaultUseCaches (false);
    // set headers and their values.
    serverCon.setRequestProperty("Content-Type",
    "application/octet-stream");
    serverCon.setRequestProperty("Content-Length",
    Long.toString(fileToUpload.length()));
    serverCon.setRequestProperty(FILENAME_HEADER, destDir +
    destFileName);
    serverCon.setRequestProperty(FILELASTMOD_HEADER, strLastMod);
    if (webadminApplet.DEBUG) System.out.println("Connection with
    FTP server established");
    // create file stream and write stream to write file data.
    FileInputStream fis = new FileInputStream(fileToUpload);
    OutputStream os = serverCon.getOutputStream();
    try
    // transfer the file in 4K chunks.
    byte[] buffer = new byte[4096];
    long byteCnt = 0;
    //long percent = 0;
    int newPercent = 0;
    int oldPercent = 0;
    while (true)
    int bytes = fis.read(buffer);
    byteCnt += bytes;
    //11-21-02 :
    //If itemID is greater than -1 this is an import file
    transfer
    //otherwise this is a header graphic file transfer.
    if (itemID > -1)
    newPercent = (int) ((double) byteCnt/ (double)
    fileSize * 100.0);
    int diff = newPercent - oldPercent;
    if (newPercent == 0 || diff >= 20)
    oldPercent = newPercent;
    jbInit.getImportTable().displayFileTransferStatus
    (itemID,
    newPercent);
    if (bytes < 0) break;
    os.write(buffer, 0, bytes);
    os.flush();
    if (webadminApplet.DEBUG) System.out.println("No of bytes
    sent: " + byteCnt);
    finally
    // close related streams.
    os.close();
    fis.close();
    if (webadminApplet.DEBUG) System.out.println("File
    Transmission complete");
    // find out what the servlet has got to say in response.
    BufferedReader reader = new BufferedReader(
    new
    InputStreamReader(serverCon.getInputStream()));
    try
    String line;
    while ((line = reader.readLine()) != null)
    if (webadminApplet.DEBUG) System.out.println(line);
    finally
    // close the reader stream from servlet.
    reader.close();
    } // end of the big try block.
    catch (Exception e)
    System.out.println("Exception during file transfer:\n" + e);
    e.printStackTrace();
    return("FTP failed. See Java Console for Errors.");
    } // end of catch block.
    return("File: " + fname + " successfully transferred.");
    } // end of method transferFile().
    } // end of class fileTransferClient
    Server side code:
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.util.*;
    import java.net.*;
    // This servlet class acts as an FTP server to enable transfer of
    files
    // from client side.
    public class FtpServerServlet extends HttpServlet
    String ftpDir = "D:\\pub\\FTP\\";
    private static final String FILENAME_HEADER = "fileName";
    private static final String FILELASTMOD_HEADER = "fileLastMod";
    public void doGet(HttpServletRequest req, HttpServletResponse resp)
    throws ServletException,
    IOException
    doPost(req, resp);
    public void doPost(HttpServletRequest req, HttpServletResponse
    resp)
    throws ServletException,
    IOException
    // ### for now enable overwrite by default.
    boolean overwrite = true;
    // get the fileName for this transmission.
    String fileName = req.getHeader(FILENAME_HEADER);
    // also get the last mod of this file.
    String strLastMod = req.getHeader(FILELASTMOD_HEADER);
    String message = "Filename: " + fileName + " saved
    successfully.";
    int status = HttpServletResponse.SC_OK;
    System.out.println("fileName from client: " + fileName);
    // if filename is not specified, complain.
    if (fileName == null)
    message = "Filename not specified";
    status = HttpServletResponse.SC_INTERNAL_SERVER_ERROR;
    else
    // open the file stream for the file about to be transferred.
    File uploadedFile = new File(fileName);
    // check if file already exists - and overwrite if necessary.
    if (uploadedFile.exists())
    if (overwrite)
    // delete the file.
    uploadedFile.delete();
    // ensure the directory is writable - and a new file may be
    created.
    if (!uploadedFile.createNewFile())
    message = "Unable to create file on server. FTP failed.";
    status = HttpServletResponse.SC_INTERNAL_SERVER_ERROR;
    else
    // get the necessary streams for file creation.
    FileOutputStream fos = new FileOutputStream(uploadedFile);
    InputStream is = req.getInputStream();
    try
    // create a buffer. 4K!
    byte[] buffer = new byte[4096];
    // read from input stream and write to file stream.
    int byteCnt = 0;
    while (true)
    int bytes = is.read(buffer);
    if (bytes < 0) break;
    byteCnt += bytes;
    // System.out.println(buffer);
    fos.write(buffer, 0, bytes);
    // flush the stream.
    fos.flush();
    } // end of try block.
    finally
    is.close();
    fos.close();
    // set last mod date for this file.
    uploadedFile.setLastModified((new
    Long(strLastMod)).longValue());
    } // end of finally block.
    } // end - the new file may be created on server.
    } // end - we have a valid filename.
    // set response headers.
    resp.setContentType("text/plain");
    resp.setStatus(status);
    if (status != HttpServletResponse.SC_OK)
    getServletContext().log("ERROR: " + message);
    // get output stream.
    PrintWriter out = resp.getWriter();
    out.println(message);
    } // end of doPost().
    } // end of class FtpServerServlet

    OK - the problem you describe is definitely what's giving you grief.
    The workaround is to use a socket connection and send your own request headers, with the content length filled in. You may have to multi-part mime encode the stream on its way out as well (I'm not about that...).
    You can use the following:
    http://porsche.cis.udel.edu:8080/cis479/lectures/slides-04/slide-02.html
    on your server to get a feel for the format that the request headers need to take.
    - Kevin
    I get the out of Memory Error on the client side. I
    was told that this might be a bug in the URLConnection
    class implementation that basically it wont know the
    content length until all the data has been written to
    the output stream, so it uses an in memory buffer to
    store the data which basically causes memory issues..
    do you think there might be a workaround of any kind..
    or maybe a way that the buffer might be flushed after
    a certain size of file has been uploaded.. ?? do you
    have any ideas?

  • Out of Memory error while builng HTML String from a Large HashMap.

    Hi,
    I am building an HTML string from a large map oject that consits of about 32000 objects using the Transformer class in java. As this HTML string needs to be displayed in the JSP page, the reponse time was too high and also some times it is throwing out of memory error.
    Please let me know how i can implement the concept of building the library tree(folder structure) HTML string for the first set of say 1000 entries and then display in the web page and then detect an onScroll event and handle it in java Script functions and come back and build the tree for the next set of entries in the map and append this string to the previous one and accordingly display it.
    please let me know whether
    1. the suggested solution was the advisable one.
    2. how to build tree(HTML String) for a set of entries in the map while iterating over the map.
    3. How to detect a onScroll event and handle it.
    Note : Handling the events in the JavaScript functions and displaying the tree is now being done using AJAX.
    Thanks for help in Advance,
    Kartheek

    Hi
    Sorry,
    I haven't seen any error in the browser as this may be Out of memory error which was not handled. I got the the following error from the web logic console
    org.apache.struts.actions.DispatchAction">Dispatch[serviceCenterHome] to method 'getUserLibraryTree' returned an exceptionjava.lang.reflect.InvocationTargetException
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:276)
         at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:196)
         at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)
         at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226)
         at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
         at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:996)
         at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:419)
         at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:315)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6452)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
         at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:118)
         at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3661)
         at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2630)
         at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
         at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)
    Caused by: java.lang.OutOfMemoryError
    </L_MSG>
    <L_MSG MN="ILHD-1109" PID="adminserver" TID="ExecuteThread: '14' for queue: 'weblogic.kernel.Default'" DT="2012/04/18 7:56:17:146" PT="WARN" AP="" DN="" SN="" SR="org.apache.struts.action.RequestProcessor">Unhandled Exception thrown: class javax.servlet.ServletException</L_MSG>
    <Apr 18, 2012 7:56:17 AM CDT> <Error> <HTTP> <BEA-101017> <[ServletContext(id=26367546,name=fcsi,context-path=/fcsi)] Root cause of ServletException.
    *java.lang.OutOfMemoryError*
    Please Advise.
    Thanks for your help in advance,
    Kartheek

  • Out of memory error, while using Adobe InDesign

    I have been running Adobe inDesign for a couple of years with no problems. This is the first time I got a, "Out of memory" error when attempting to save the document as a PDF.
    Windows 7, Dell Studio XPS, 2.80 GHz Processor, Memory: 9 GB Dram, Hard Drive: 1.5 TB, 1.56 MB cache.
    Firefox v33.02
    What should I do to get back the memory?
    Thank you,
    Don Schaaf

    Hi Don, is this an Adobe site you are using in a Firefox tab, or the stand-alone InDesign application?
    If it's in the application, you may want to try Adobe's forum. You also could try closing other open applications to have them release memory and then try creating the PDF again.
    Please note that if Firefox has been running for a long time and is using a lot of memory, it may take several minutes to release it all, as various files are (slowly) updated at shutdown. You can monitor its progress in the Windows Task Manager on the Process tab. Press Ctrl+Shift+Esc to open the Task Manager, and then click the processes tab. Firefox will be listed under firefox.exe here. Please allow it to shut down normally instead of using the End Process button, unless it appears to hang (no movement in the amount of memory used for several minutes).

  • Indesign cs5 'out of memory' error when using preflight

    I have been regulary getting an 'out of memory' error when i choose to use my bespoke preflight profile.
    I have 4gig of ram and run Indesign CS5 on OS 10.6.8.
    Does anyone know a work around?
    As soon as I select from the basic default profile, i get the beach ball from hell for 10mins, then it kindly lets me know that I am out of memory, sends a crash report to Adobe and then asks if I want to relauch. I'm stuck in a vicious circle. I must of sent my 4th crash report now and no feedback from anyone at Adobe.

    I have replaced my preferences, but still the problem persists. I have tried switching my view from typical display to fast display before i selected a profile. I thought this may give me the extra memory I needed to avoid the enevitable crash. I learnt that 2 files were indeed rgb instead of cmyk before it crashed again. So I switched them to cmyk and tried again, selected my bespoke profile, but yet again it crashed. I think the problem lies with the file, not Indesign, as i have tried the same profile on a different file and the program doesn't crash and runs as it should. So if in future I need to use said crashing file again, firstly i will need to try Peter's isolate fix method. Otherwise i'll never be able to progress to successful a pdf.

  • Getting 'Out of memory' error while opening the file. I have tried several versions of Adobe 7.0,9.0,X1. It is creating issue to convert PDF into TIFF. Please provide the solution ASAP

    Hello All,
    I am getting 'Out of memory' error while opening the file. I have tried several versions of Adobe 7.0,9.0,X1.
    Also, it is creating issue to convert PDF into TIFF. Please provide the solution ASAP.

    I am using Adobe reader XI. When i open PDF it gives "OUT of memory" error after scrolling PDF gives another alert "Insufficient data for an image". after clicking both alerts it loads full data of PDF. It is not happening with all PDFs. couple of PDFs are facing this issue. Because of this error my software is not able to print these PDFS into TIFF. My OS in window7*64. I tried it on win2012R2 and XP. Same issue is generating there.
    It has become critical issue for my production.

  • Out of Memory Error and large video files

    I created a simple page that links a few large video files (2.5 gig) total size. On Preview or FTP upload Mues crashes and gives a Out of Memory error. How should we handle very large files like this?

    Upload the files to your host using an FTP client (i.e. Filezilla) and hyperlink to them from within your Muse site.
    Muse is currently not designed to upload files this large. The upload functionality takes the simple approach of reading an entire linked file into RAM and then uploading it. Given Muse is currently a 32-bit application, it's limited to using 2Gb of RAM (or less) at any given time regardless of how much RAM you have physically installed. We should add a check to the "Link to File..." feature so it rejects files larger than a few hundred megs and puts up a explanation alert. (We're also hard at work on the move to being a 64-bit app, but that's not a small change.)
    In general your site visitor will have a much better experience viewing such videos if you upload them to a service like YouTube or Vimeo rather than hosting them yourself. Video hosting services provide a huge amount of optimization of the delivery of video that's not present for a file hosted on standard hosting (i.e. automatic resizing of the video to the appropriate resolution for the visitor's device (rather than potentially downloading a huge amount of unneeded data), transcoding to the video format required by the visitor's browser (rather than either having to due so yourself or have some visitors unable to view your video), automatic distribution of a highly viewed video to multiple data centers for better performance in multiple geographies, and no doubt tons of other stuff I'm not thinking of or am ignorant of.

  • "Out of memory" error using SmartView v11.1.1.3.500, MS Excel 2007 & MS Win7 Prof SP1 (all 32-bit)

    Hi All,
    A user is regularly experiencing "Out of memory" error messages while retrieving large MS Excel 2007 worksheets (ad-hoc analysis; approx 700 rows by 13 columns) connected to a Planning cube via 32-bit SmartView v11.1.1.3.500 (Build 008) on a 32-bit MS Windows 7 Prof (SP1) computer with 4GB of RAM. The same user is reporting experiencing a number of other issues (eg, TCP-related time-out, unable to connect to the APS, SmartView add-in disappearing, etc) at the same time.
    I could not locate any specific KB document from the My Oracle Support website which addressed these specific issues all at once but from various posts out there, the recommendations to address similar issues were as follows:
    Tick the Options > Display > Reduce Excel file size option;
    Tick the Options > Display > Improve metadata storage option;
    Rebuild the MS Excel workbook from scratch;
    Delete all temp files located in the C:\Users\USER NAME\AppData\Local\Temp directory;
    Disable auto-recovery for MS Excel;
    Add misc TCP-related registry entries (eg, TcpTimedWaitDelay, MaxUserPort, MaxFreeTcbs, etc) on both the client PC and server;
    Adjust MS Windows for best performance;
    Increase the page file by 25%-50% more than the physical amount of RAM installed on the client PC;
    Relocate the page file to a different drive as compared to the drive where MS Windows is installed on the client PC;
    On top of the above, are there any other recommendations anyone else would like to share to address the "Out of memory" issue?
    Many thanks in advance,
    JBM

    Monitor the Full GC in GC log and see if there is any gradual increase in the free memory retained after every Full GC over a period, if there is a gradual increase and if its reaching maximum specified heap over a period of time, that means there might be some slow leak from application or native libraries.
    Also please check if you have any pattern or request which might be triggering OOM all of the sudden.
    If its memory leak best way to investigate that is to capture JRA's at regular interval's and monitor top 10 objects and see which one is growing and consuming more % of heap over a period of time.
    You can also have this by captured by print_object_summary and print_memusage options in JRCMD command over a period of time.
    Hope this helps.
    - Tarun

  • Out of memory error - large project

    I'm consulting on a feature doc edit, and the primary editor (Avid guy) is having serious problems accessing anything from the original project.
    It's an hour and 15 minute show, with probably close to 100 hours of footage.
    The box is a D2.3 G5 with 1.5 g of RAM, and the media is on two G-Tech drives: a G-RAID and a G-Drive. Plenty of headroom on both (now) and the system drive is brand new, having been replaced after the original died, and there's nothing loaded on it but FC Studio. The FCP version is 5.1.4. The project file is well over 100 MB.
    We started getting Out of Memory errors with this large project, and I checked all of the usual suspects: CMYK graphics, hard drive space, sufficient RAM... all checked out okay, except possibly the less-than-ideal amount of RAM.
    I copied the important sequences and a couple of select bins to a new project, and everything seems workable for now. The project is still 90 MB, and I've suggested breaking it up into separate projects and work on it as reels, but we can edit and trims work efficiently at the moment. However, the other editor has gotten to a point now where he can't even open bins in the old, big project. He keeps getting the OOM error whenever he tries to do anything.
    I have no similar problems opening the same project on my G5, which is essentially identical except I have 2.5 G RAM (1 G extra). Can this difference in RAM really make this big a deal? Is there something else I'm missing? Why can't this editor access even bins from the other project?
    G4   Mac OS X (10.2.x)  

    Shane's spot on.
    What I often do with large projects is pare down, just what you have done. But 90 out of 100 is not a big paredown by any stretch. In the new copy throw away EVERYTHING that's outdated: old sequences are the big culprit. Also toss any render files and re-render.
    Remember that, to be effective fcp keeps EVERYTHING in ram, so that it can instantly access anything in your project. The more there is to keep track of the slower you get.

  • Out of memory error when writing large file

    I have the piece of code below which works fine for writing small files, but when it encounters much larger files (>80M), the jvm throws an out of memory error.
    I believe it has something to do with the Stream classes. If I were to replace my PrintStream reference with the System.out object (which is commented out below), then it runs fine.
    Anyone else encountered this before?
         print = new PrintStream(new FileOutputStream(new File(a_persistDir, getCacheFilename()),
                                                                false));
    //      print = System.out;
              for(Iterator strings = m_lookupTable.keySet().iterator(); strings.hasNext(); ) {
                   StringBuffer sb = new StringBuffer();
                   String string = (String) strings.next();
                   String id = string;
                   sb.append(string).append(KEY_VALUE_SEPARATOR);
                   Collection ids = (Collection) m_lookupTable.get(id);
                   for(Iterator idsIter = ids.iterator(); idsIter.hasNext();) {
                        IBlockingResult blockingResult = (IBlockingResult) idsIter.next();
                        sb.append(blockingResult.getId()).append(VALUE_SEPARATOR);
                   print.println(sb.toString());
                   print.flush();
    } catch (IOException e) {
    } finally {
         if( print != null )
              print.close();
    }

    Yes, my first code would just print the strings as I got them. But it was running out of memory then as well. I thought of constructing a StringBuffer first because I was afraid that the PrintStream wasn't allocating the memory correctly.
    I've also tried flushing the PrintStream after every line is written but I still run into trouble.

  • Out of memory error using RowSets

    I am trying to generate a report based on values in a table. My
    view object in JDeveloper consistys of a union of two tables,
    each containing about 25,000 records. For my report, I need to
    retrieve each row from the table and then write it to a file in
    a specific format. The problem lies in attempting to retrieve
    the rows. Setting the rangesize to -1 and then attempting to
    retrieve all rows in range results in an out of memory error.
    Trying to set the range to something smaller, retreiving the
    rows, writing to the file, then scrolling the range to the next
    section also results in an out of memory error. Any suggestions
    regarding this would be greatly appreciated.
    Suhail

    I am using JDev 3.2.2 and JDK version 1.2.2. What I need to do
    is to read the table, one row at a time, perform some
    calculations, and then write the data to a file.

Maybe you are looking for