clementfarabet/lua---parallel — pull request #2 by fidlej (2012-10-31 14:13:52+00:00)
Title: Let __gc be inside of the metatables

I have noticed that __gc() was not called on zmq sockets and contexts.
The __gc was not inside of their metatables.
The __gc was only inside the __index table.

The following is a test case, to see the non-garbage-collecting of sockets.
If your "ulimit -n" is less than 2000, the test failed with "Too many open files".

require 'libluazmq'

local ctx = assert(zmq.init(1))
for i = 1, 2000 do
local socket = assert(ctx:socket(zmq.PULL))
socket = nil
collectgarbage()
end