I have faced a problem, when I run my project it goes well for some seconds and after it throws me an error:
as I find I did it by using many loops or "for"s or I may not close my DB statement. being honest I didnt close my DB statements, which I do it now.
But its still giving me that error!
I think I need to set that memory free, but how? can you elaborate on it for me? or introduce me a source.
excuse me, But I am really new in this one! may it seems a little stupid!
but let me explain step by step, what you mean is :
1)I need to go to command promp
2) then write "Xms<256m>" for example. right?
but it says: the syntax of the command is incorrect!!
Also,I found a program who tells me how much memory heap I have now, which returns me:
Heap Size = 5177344
I read 256m is for small program like "hellow world" but mine is rather bigger project(including DBs and agents) but I dont know how much memory I need ?
you don't type the -Xmx1024M by itself on the command line, but as part of your java call:
c:\>java -Xmx1024M -Xms1024M MyClass
Note that this doesn't necessarily FIX your problem, it might just be hiding it. If your code is not releasing things it should, you may still have the same problem at some point but you're just not hitting the limit yet.
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
The JConsole tool, which comes with the JDK, can help you profile your program's memory usage.
Joined: Jul 06, 2009
I find how to track this leaking points or to make sure where they are coming from (from JDBC connections? or generating Many objects ? or your program really needs a big heap memory to run! and there is nothing wrong with the program).
So if there are normal amount of connections its not JDBC connections which are consuming the memory!
3) If you think nothings wrong with your code and it just nedd more memory there are two ways to change the setting: 1) Command prompt and 2) your IDE. I Killed my self but couldnt do it by command way .
IDE way is sooo easy just go to netbeans click right on the project name > properties>run and then in "VM options" text box copy "-Xms32m -Xmx128m" and its done!!
and thats all I experienced!
If any one have any other suggestion is welcomed!