It is fault of ruby's fcgi extension, you can either use the pure ruby fcgi code or patch the ext/fcgi/fcgi.c, search for "FCGX_Finish", then add a line of code:
FCGX_Free( data->req, 1 );
There might be other problems, like memory leak, in the fcgi extension. You can contact the author...