From: Seebs Date: 2008-06-29T18:57:25+09:00 Subject: Re: mysterious memory corruption, very confused On 2008-06-29, Seebs wrote: > I'm afraid I can't make this bug report much more useful, I don't really > understand the code. I don't know how the garbage collector works, either. > ... But interestingly, wrapping the call to the API function this wraps > in GC.disable/GC.enable makes the bug go away. I'll annotate my rubyforge > bug, but if anyone here can tell me what I should be doing properly to > tag these things not to be collected until this function is done, I'd love > to know. Okay, this is almost certainly wrong, but: I experimentally added an array of N "VALUE" objects. After the first hunk of code has obtained the "correct" value, I then stash that value in the Nth item of the array (or store a 0 there), and call rb_gc_register_address(¶m_string_values[i]); After calling the postgresql function, I loop through calling rb_gc_unregister_address(¶m_string_values[i]); The program now runs on the whole data set available to me without errors; that's about 15x as long as it usually made it before. I'm not saying this is the correct fix, but I think it is pretty good confirmation that the analysis is right and the garbagec collector is the culprit. -- Copyright 2008, all wrongs reversed. Peter Seebach / usenet-nospam@seebs.net http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!