Dear folks, i'm currently debugging a possible-memory leak in an application which uses zookeeper. I found ZooKeeper$ZkWatchManager.existWatches growing large - probably a usage problem.
However i'm running a small test app in loop a session expiration happens from time to time. On an expired event the app closes the current ZooKeeper instance on and creates a new instance of it. What i found out through debugging is that the number of ZooKeeper instances in the system is constantly growing, with most instances in state CLOSED. Forcing GC doesn't change anything here. Looking at the references it i seems like a closed ZooKeeper instance is only referenced by a ClientCnxn, and this ClientCnxn is referenced only bye a ZooKeeper + Send- and Event-thread. So i suspect this reference cycle prevents the garbage collection... Johannes
