From: Robert Klemme Date: 2006-10-29T20:20:19+09:00 Subject: Re: Memory crush somewhere in Socket Victor "Zverok" Shepelev wrote: > Hi all. > > I have a very strange and uncommon problem. > > I have Ruby version 1.9 from 13 oct 2006 on Windows XP. > > I use some complex library from Ruby (large .dll + C extension I've written > to talk to DLL from Ruby). > > All works well, but when I try using the library together with Net::HTTP, I > have segmentation faults. > > The code looks like: > > --- > Net::HTTP.get_response '192.168.1.1', '/index.html' > SomeLibrary.call_some_method > --- > > The segfault appeared on second line, in the deeps in SomeLibrary.dll > If I not using Net::HTTP calls in first line (instead, I read something from > local file) - all works good. > SomeLibrary's author debugged the case and said "somebody shoot my memory", > like: > -- > HEAP[ruby.exe]: HEAP: Free Heap block 33a6e48 modified at 33a6e74 after it > was freed > -- > > I've debugged (through dumb commenting/uncommenting lines) that the problem > seems to be inside socket.readline inside HTTPResponse.read_status_line > (net/http.rb, line 2017). Unfortuately, just now I have no advanced memory > debugging tools to say something more concrete about who and how shoots the > memory. > > What can I do with this? I'd be happy to any advices! > > (If it is important, SomeLibrary == HTMLayout, custom HTML layouting engine. > It doesn't use IE or Firefox, but it may use some Windows socket and inet > API - can the problem lay here?) Sounds like a reasonable guess. Also, I do not understand why a HTML layouting lib needs sockets - especially in this case as you seem to pull the content via Net::HTTP. IMHO layout != transport - but then again I do not know this lib. Good luck robert