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 4543980
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T15:36:24+00:00 2026-05-21T15:36:24+00:00

Ok, so I have this program with many (~300) threads, each of which communicates

  • 0

Ok, so I have this program with many (~300) threads, each of which communicates with a central database. I create a global connection to the DB, and then each thread goes about its business creating statements and executing them.

Somewhere along the way, I have a massive memory leak. After analyzing the heap dump, I see that the com.mysql.jdbc.JDBC4Connection object is 70 MB, because it has 800,000 items in “openStatements” (a hash map). Somewhere it’s not properly closing the statements that I create, but I cannot for the life of me figure out where (every single time I open one, I close it as well). Any ideas why this might be occurring?

  • 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-05-21T15:36:25+00:00Added an answer on May 21, 2026 at 3:36 pm

    You know unless MySQL says so, JDBC Connections are NOT thread safe. You CANNOT share them across threads, unless you use a connection pool. In addition as pointed out you should be try/finally guaranteeing all statements, result sets, and connections are closed.

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

Sidebar

Related Questions

I have written this program, which sorts some ints using a functor: #include<iostream> #include<list>
I have run this program before and it worked fine. Then I added the
I have spent many hours working on this program that is supposed to play
I have this program that should execute a piece of code base on the
I have this program, but cin in randomly skips.. I mean sometimes it does,
I have this program that I am working on for class, I think the
note: I am sorry if this is a stupid question! I have this program
I have this function: Program A public ICollection<ReportLocationInfo> GetAllReportsInstalled() { return _Reports; } I
I have this servlet program and an external .jar file (written by someone else)
I have this C++ program: int box[9][9]; box = { {solution[0][0],solution[0][1],solution[0][2],solution[1][0],solution[1][1],solution[1][2],solution[2][0],solution[2][1],solution[2][2]}, {solution[0][3],solution[0][4],solution[0][5],solution[1][3],solution[1][4],solution[1][5],solution[2][3],solution[2][4],solution[2][5]}, {solution[0][6],solution[0][7],solution[0][8],solution[1][6],solution[1][7],solution[1][8],solution[2][6],solution[2][7],solution[2][8]}, {solution[3][0],solution[3][1],solution[3][2],solution[4][0],solution[4][1],solution[4][2],solution[5][0],solution[5][1],solution[5][2]},

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.