This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Basic question i have 1 iterations code 2nd iteration code is bit more in size ... when we run appln with ietration 1 code in memory it javaw.exe takes less MB 2nd iteration code takes more memory (javaw.exe takes more MB) than the iteration 1 's code
yes second iteration code is more and new programmers have coded them , hence when running the appln javaw.exe is taking so much of memory than prior iteration code apart from increasing heap memory size in complier options do we have any options
How much memory a program needs, depends on what the program does; how many objects it allocates etc.
Since you didn't tell us anything about what your program does and what exactly the differences are in the code, it is impossible to give you a precise anwer.
It's easy to write a 5-line program that uses a lot of memory. The memory usage doesn't have anything to do with the size of the source code.
You'll just have to go and look at the code, or maybe use a profiler, to see why the program uses so much more memory. (A profiler is a tool that measures the execution speed and memory usage of a program while it's running).
apart from increasing heap memory size in complier options do we have any options
There is no magic wand you can wave and get lower memory use. More code means more objects so more runtime memory will be required. Why are you talking about compiler options? It is runtime options that affect memory use. Bill
I just wonder because, if you are using Windows Task Manager to do it, there is a common trap that people fall into. The Windows Task Manager column "Memory Usage" is the amount of *physical* memory used. This is not a particularly useful figure, as the Java classes and heap are in *virtual* memory. You need to look at the "VM Size" column, which is not shown in Task Manager by default, but can be added from the menu.
If you're not using Windows, or you've not made this mistake, please accept my apologies for the suggestion.
Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.
Hi Friends Thanks for your valuable replies... later after investigating i came to know that our framework intialises the facade and Dao factory ... as code increases i.e ( adding couple of mtds in DAO) i think it is obvious that it will takle more memory . Is there any Runtime GC code which i can run to avoid to decrease the memory consuption will which i will run frequently Any Idea will this work out ?.
There are some cool tools for watching memory use. With Java5 or later you get JConsole. You can watch the various areas of memory go up and then GC. It's not a problem to see usage go near the max between GCs. It is probably a problem to see the low end of the sawtooth graph go up and up all day.
One of our guys uses an IBM tool that reads verbose GC logs and spits out a report of large object creation (over a configured threshold). That helped us find a class that was trying to log a 10meg string (!). It never got to the log because the switch was turned off for that class, but it got through message formatting which made multiple copies of the data.
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Author and all-around good cowpoke
Joined: Mar 22, 2000
Exactly what are you worried about?
Is there some sort of hard limit to the amount of memory this app is allowed to use or is this just generalized worry about memory use getting out of control?
In any case, it is not GC code you should be looking for but memory management techniques and best practice. Let Java take care of GC for you.
You might want to take a look at the java.lang.ref package of classes for flexible object management.