Results 1 to 9 of 9
- 06-23-2011, 02:07 PM #1
Member
- Join Date
- Jun 2011
- Posts
- 12
- Rep Power
- 0
Reduce desktop application memory
I'm developing a windows desktop (standalone) application which runs as an endless loop.
Once the application starts, a database connection is created (java.sql.Connection) and is used all over the application.
The loop does the following operations:
* Call web services
* Execute Sql queries to read data from Database
* Write image (downloaded by one of the web services) to disk. (approximately ~80KB)
My application takes about 50 MB memory.
How can I reduce my application memory usage?
- 06-23-2011, 02:50 PM #2
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,427
- Blog Entries
- 7
- Rep Power
- 17
- 06-24-2011, 08:49 AM #3
Senior Member
- Join Date
- Nov 2010
- Location
- Delhi
- Posts
- 135
- Blog Entries
- 1
- Rep Power
- 0
Its near to impossible to tell how to reduce the memory without looking at the code. A proper review would be required to tell something.My application takes about 50 MB memory.
How can I reduce my application memory usage?
However, make sure you are:
1. creating objects only at the point of their requirement.
2. finalizing the objects as soon as their need ends.
3. handling writer objects properly.
- 06-24-2011, 09:37 AM #4
What?2. finalizing the objects as soon as their need ends.
db
- 06-24-2011, 10:15 AM #5
Moderator
- Join Date
- Apr 2009
- Posts
- 10,481
- Rep Power
- 16
As Jos says, this is a pretty small app anyway.
But that aside, shrink Xmx to the amount you want your app to fit in (something we cannot say, but you appear to have a size requirement). See if it crashes. Take a heap dump on an OOM exception and analyse it to see what was using the memory at the time of the crash. See if you can somehow reduce that. if not then you'll need a larger memory footprint.
- 06-24-2011, 12:37 PM #6
Senior Member
- Join Date
- Nov 2010
- Location
- Delhi
- Posts
- 135
- Blog Entries
- 1
- Rep Power
- 0
- 06-24-2011, 12:48 PM #7
If variables are declared in the correct scope, it's virtually never needed to null them explicitly.
db
- 06-24-2011, 01:29 PM #8
Senior Member
- Join Date
- Nov 2010
- Location
- Delhi
- Posts
- 135
- Blog Entries
- 1
- Rep Power
- 0
- 06-26-2011, 11:54 AM #9
Member
- Join Date
- Jun 2011
- Posts
- 12
- Rep Power
- 0
Similar Threads
-
Datasource in desktop application
By Manolo in forum Advanced JavaReplies: 4Last Post: 04-28-2011, 07:29 AM -
Desktop Application
By vineet osho in forum New To JavaReplies: 3Last Post: 06-13-2010, 05:37 AM -
Remote Desktop Application
By Drango in forum CLDC and MIDPReplies: 2Last Post: 05-17-2010, 11:22 PM -
Help in converting Java application to desktop application in Netbeans
By realahmed8 in forum AWT / SwingReplies: 3Last Post: 12-04-2009, 12:10 PM -
How to reduce the size or avoiding out of memory error?
By rajeshkumarmsc in forum Advanced JavaReplies: 3Last Post: 08-11-2007, 10:15 PM


1Likes
LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks