From: | marek at lewczuk(dot)com (Marek Lewczuk) |
---|---|
To: | |
Subject: | [Pljava-dev] out of memory |
Date: | 2006-04-19 07:07:42 |
Message-ID: | 4445E1BE.8060002@lewczuk.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pljava-dev |
Thomas Hallgren napisa?(a):
> Marek,
> You definitely have a memory leak somewhere. The process consumes 2.5
> Gigabytes when it seems to hang. From the looks of it, it doesn't
> actually hang but it is very, very slow (consumes 0.6 %CPU). Your
> main-thread may well hang at this point, the rest of the activity might
> be a struggling garbage collector. Is there any chance that you have a
> huge map or array building up somewhere?
There are no maps at all, but I find the part of the code which (when
enabled) leads to memory leak.
// insert into regional registrations table
{
Statement s = connection.createStatement();
ResultSet r = s.executeQuery("SELECT oCarTypeId FROM
samarapp_data.sapp_cda_pl_cep_rre WHERE oCarTypeId = " + co + " AND
nCarTypeId = " + cn + " AND nMakeId = " + mk + " AND nModelId = " + mo +
" AND nDistrictW = " + rw + " AND nDistrictP = " + rp + " AND
productionYear = " + result.getInt("productionyear") + " AND
registrationYear = " + result.getInt("registrationyear"));
if (r.next() == false) s.execute("INSERT INTO
samarapp_data.sapp_cda_pl_cep_rre (oCarTypeId, nCarTypeId, nMakeId,
nModelId, nDistrictW, nDistrictP, productionYear, registrationYear,
registrationMonth" + result.getInt("registrationmonth") + ") VALUES (" +
co + "," + cn + "," + mk + "," + mo + "," + rw + "," + rp + "," +
result.getInt("productionyear") + "," +
result.getInt("registrationyear") + "," +
result.getInt("registrationamount") + ")");
else s.execute("UPDATE samarapp_data.sapp_cda_pl_cep_rre SET
registrationMonth" + result.getInt("registrationmonth") + "=" +
result.getInt("registrationamount") + " WHERE oCarTypeId = " + co + "
AND nCarTypeId = " + cn + " AND nMakeId = " + mk + " AND nModelId = " +
mo + " AND nDistrictW = " + rw + " AND nDistrictP = " + rp + " AND
productionYear = " + result.getInt("productionyear") + " AND
registrationYear = " + result.getInt("registrationyear"));
r.close();
s.close();
}
I thought that change from "execute" to "executeUpdate" will fix this
but unfortunatelly it didn't. Would you like to see the full source code ?
> Not normally no. As I said previously, I'm trying to eliminate possible
> causes for the leak. The more I know about your code and your setup, the
> better the prognoses that I find something. Ideally, I'd like to look at
> your function. You still keep your configuration a secret. What system
> are you using? PostgreSQL version, OS version, Java version?
PostgreSQL 8.1.0, Linux Debian, Java JDK1.5.0_04
From | Date | Subject | |
---|---|---|---|
Next Message | Marek Lewczuk | 2006-04-19 07:13:10 | [Pljava-dev] out of memory |
Previous Message | Thomas Hallgren | 2006-04-12 06:19:30 | [Pljava-dev] out of memory |