Thank you Chuck!!! I cannot believe I didn't catch that. I actually never write it like that but rather like you suggest - hence my other code works perfectly.
I spend hours debugging this looking at pretty much everything else and finally narrowing it down to the GC, which of course was correct. I am quite happy that my holiday vacation starts today :) Again, thanks a lot for your quick reply! Mvh Morten Møller Riis On Dec 21, 2011, at 2:20 AM, Martin Sustrik wrote: > On 12/21/2011 06:25 AM, Chuck Remes wrote: > >> This isn't new for 2.1. I think you are just getting lucky on that >> other code. >> >> The problem is this line: >> >>> @socket = ZMQ::Context.new.socket(ZMQ::UPSTREAM) >> >> >> You are not saving a reference to the context that you just created, >> so the GC will reap it at some point. Change it to: >> >>> @context = ZMQ::Context.new @socket = >>> @context.socket(ZMQ::UPSTREAM) >> >> And now all will be well with the world. > > IIRC Java binding was facing this problem already. > > What they've done was to hold a Java reference to every socket created > in the context: > > https://github.com/zeromq/jzmq/blob/master/src/org/zeromq/ZContext.java#L32 > > That prevents gc to deallocate the context while there are sockets still > around. > > Martin > _______________________________________________ > zeromq-dev mailing list > [email protected] > http://lists.zeromq.org/mailman/listinfo/zeromq-dev
_______________________________________________ zeromq-dev mailing list [email protected] http://lists.zeromq.org/mailman/listinfo/zeromq-dev
