[zeromq-dev] Java bindings error?

Martin Sustrik sustrik at 250bpm.com
Wed Jun 23 19:56:46 CEST 2010


Hi Stuart,

>> Is it possible that garbage collector destroys the context object even 
>> though there are still sockets open?
> 
> Yes, but the by far most likely scenario here is that there is a bug in the native part of jzmq (as opposed to the JVM).

What I meant was that context is created, then used to create the socket 
and afterwards it's not used any more. Can that result in gc destroying 
it after the socket creation but before the program ends?

>> How does gc know what to destroy btw? It analyses the code and when it 
>> sees "this object is not going to be used" it finalises it?
> 
> GC analyzes the running program and may destroy things that are unreachable. The objects in play in the performance tests are plainly still reachable, so that shouldn't be a problem.
> 
> Would it be helpful for me to fork the repository and commit my test changes so that you can see exactly what I am seeing?

What would help is if you can print/log something in context's 
finalisation function. That way we'll be sure whether context is being 
destroyed while the test is still running.

Martin



More information about the zeromq-dev mailing list