简体   繁体   中英

How to check what thread or object is still used or not?

could anyone tell me how I can see which activities / threads remain active and are no longer called by my application?

For example, if I open an HTTP stream and then don't flush, but continue to open new ones, the memory used will continue to go up until the GC passes to clean up. is it possible to somehow see which threads or objects etc that have been generated and are not used for a given time x?

The reason for this request is due to the fact that having a server deployed with an application, this continues to increase the memory incrementally up to the limit whereby the GC is forced to intervene to re-establish a stable memory situation.

I don't know if it can be helpful in this analysis but the gcc parameters are set to:

-Xms8g -Xmx8g -XX: PermSize = 1024 XX: MaxPermSize = 1024

the machine's ram is 18g.

thanks to all in advance

To check whether an object is still used, perform a full GC. There isn't a short cut for this action.

You don't know if an object is needed until a garbage collection is performed.

the memory used will continue to go up until the GC passes to clean up.

This is normal in a JVM. To improve performance, you want to reuse expensive objects, and not worry too much about cheap objects. You also need to tune the GC so that when it does run, it doesn't impact your application too much.

NOTE: Perm Gen was dropped in Java 8, and from March 2019, only Java 12 has free updates from Oracle, so will need to consider upgrading at some point.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM