Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8586251
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T22:15:59+00:00 2026-06-11T22:15:59+00:00

Compilefile.this.compileThread = new Thread() { @Override public void run() { try { synchronized (this)

  • 0
 Compilefile.this.compileThread = new Thread() {
    @Override
    public void run() {
        try {
            synchronized (this) {
                Application.getDBHandler().setAutoCommit(false);
                MIBParserUtils.getDefaultMibsMap();
                compileSelectedFiles();
                Application.getDBHandler().CommitTrans();
                Application.getDBHandler().setAutoCommit(true);
            }
        }
        catch(OutOfMemoryError exp) {
            JOptionPane.showMessageDialog(null, "Compilation Stopped.. Insufficient Memory!!!");
            CompileMib.this.compileThread.interrupt();
            System.gc();

            dispose();
            NmsLogger.writeDebugLog(exp);   
        }
        finally {
        }
    }

I tried to compile some files within a thread. The UI selects more than 200 files to compile. During compilation an OutOfMemoryError occurred due to in sufficient memory in Eclipse. I want to stop the thread and display a message box and dispose the compile window in my application. I wrote the below code but its not working. Can I catch the exception and handle it, or is there a better solution?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T22:16:00+00:00Added an answer on June 11, 2026 at 10:16 pm

    can i handle the exception in catch block?

    You can certainly catch an OOME. But successfully recovering is another thing entirely. This Answer discusses some of the issues: https://stackoverflow.com/a/1692421/139985.

    Another thing to consider is that the OOME might be being thrown on a different thread:

    • The compileSelectedFiles() method or one of the other methods could be doing the work on another thread and throwing OOME there.

    • The OOME could be being thrown on one of Eclipse’s background threads.

    In either case, that catch obviously won’t catch it.

    It is worth noting that calling System.gc() after an OOME is a waste of time. I can guarantee that it won’t release any memory that wouldn’t be released anyway. All you are doing is suggesting that the JVM waste time on something that won’t help. If you are lucky, the JVM will ignore the suggestion.


    My advice would be to just increase Eclipse’s heap size by altering the -Xmx JVM parameter in the eclipse.ini file.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an application that is supporting iOS 2.0. The Base SDK is set
I doubt anyone can help with this question because of the following in Erlang's
This question is referring to the Modules in C++ proposals floating around, and more
If I run the following PHP code: apc_compile_file(relative/path/to/file); will it invalidate the in-memory cache
It's time for another 'how do i do this in c++ without loosing my
I want to build two different APK's from my Android application. The differance between
I have to frequently compile small program and run it. Since, it was tedious
I'm trying to compile some .less files using django-pipeline . When I run collectstatic
I try to use htmlcxx to parse a webpage. The problem is, the example
I'm trying to write a class that will be in charge of persisting application

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.