how to reduce memory usage of java takes 18 mb memory when started,when i starts new thread it takes 47 mb of memory .After i closed the started thread ,the memory is not reduced to 18 mb. It still stays at 47mb of memory usage.

First, ensure a garbage collection is done, then see if it is reduced, at all.

Other than this, java will only return memory to the system if a certain percentage of the heap space is "free", there are command line parameters to use increase/decrease these ratios, but I suggest caution. Simply figure with your java process using the max heap amount of memory (plus some more, since permgen is not included in max heap and java does need some system memory).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.