Hi, ----- Original Message ----- From: "Shashank Date" <sdate / everestkc.net> Newsgroups: comp.lang.ruby To: "ruby-talk ML" <ruby-talk / ruby-lang.org> Sent: Saturday, August 30, 2003 3:40 PM Subject: Re: [ANN] sys-win32etc 0.0.2 > > "Daniel Berger" <djberg96 / hotmail.com> > > Hmm...'\\' should work with single quotes. Please try and let me > > know. If so, I'll update the docs. > > Did not work with single quotes either. Had to use double-backslash twice. > > > Thank you very much for the feedback. Any idea on the memory leaks? > > To see what I mean, try this bit of code and pull up the Task Manager > > to watch the memory usage: > > > > while 1 > > Win32Etc.group{ |g| > > p g > > } > > sleep 3 > > end > > > > Not that you would do this in real code, but it demonstrates the > > problem. > > Yes, I could recreate the problem but have not figured a way to avoid > it. Will take a look at it over the wekk-end (if possible). > The memory leak is due to memory allocation of struct like these VALUE gstruct = rb_struct_new(Group); rb_struct_aset(gstruct,INT2NUM(0),rb_str_new2(dest)); A simple and stupid solution is replace if(rb_block_given_p()){ rb_yield(gstruct); } with if(rb_block_given_p()){ rb_ensure(rb_yield,gstruct,obj_free,gstruct); } and define obj_free like this static VALUE obj_free(VALUE obj) { rb_gc(); return Qnil; } Park Heesob