Memory leak with WSDLDriverFactory?

My app makes use of a 3rd party webservice to lookup company
information. However, there seems to be a major memory leak with
WSDLDriverFactory.

I do:
class MyService
@@auth_hash = { :username => ‘username’, :password => ‘password’ }
@@wsdl = ‘http://mywsdlurl
@@driver = SOAP::WSDLDriverFactory.new(@@wsdl).create_rpc_driver

Call this several times

def self.search_firms(name, state = ‘’)
results = @@driver.Firms_Info({ :name => name, :state =>
state}.merge(@@auth_hash))

Process the results

end
end

Every call to driver.Firms_Info grabs memory that I can never get
back. My app will process hundreds (sometimes 1000’s) of companies at
a time, but the process ends up sucking up all my memory and things
slow to a crawl. No matter what I do I can’t get the memory back. I
tried sprinkling GC.start calls around and make sure to set things to
nil when done. In the end, I commented out everything but the
driver.Firms_Info call, and I still lost 100’s of megs very quickly.

I saw several mentions of a memory leak in Hash, but they are old. I
know WSDLDriverFactory converts everything to Hash, so maybe that
isn’t fixed yet.

Anyone else see this? Any work-arounds?

I’m using Ruby 1.8.6 and Rails 2.0.2.

After a little more digging, it looks like the leak happens whenever
the SOAP server throws an exception. I handle the exceptions in the
caller and continue on, but driver seems to hold onto all the memory
of the results. Reloading the driver doesn’t help.

Unfortunately, the vendor’s SOAP server is prone to throwing errors,
so I’m stuck. I guess I could implement the SOAP client raw, but I
would think WSDLDriverFactory would ensure that its resources were let
go even when there is an exception.

Thoughts?