Nava Carmon
ncarm****@mac*****
Wed Jul 1 04:08:20 JST 2009
Hello, I'm very new to ruby. I have a task to eliminate memory leaks in rubycocoa application. I downloaded the latest version of RubyCocoa framework 0.13.2 and found out, that it has code that leaks. For example: OverrideMixin.m class function ovmix_imp_for_type the following code for (i = 0; i < argc; i++) { if (i >= 2) octypes[i - 1] = arg_types[i]; } octypes[0] = retval_type; produces leaks, since when we have only 2 arguments, the octypes is never being filled with arg_types values, since the iteration stops at 1. this way st_lookup never returns ok and the memory never get freed. I fixed it to the following (not committed though): for (i = 1; i <= args; i++) { octypes[i] = arg_types[i - 1]; } octypes[0] = retval_type; Further more, the pointer to array arg_types should be freed in any case, because arg_type members are being assigned to other variables and this pointer is lost and not freed. There is a place where strdup is being passed as a parameter to a function, that gets const char *! strdup calls for a malloc! See in the same file imp_c_addRubyMethod_withType function. Now the most frustrating thing is that each call of rbobj_call_ruby function calls for kind of ruby malloc which is another leak. Please see if these leaks can be fixed. My application is a process, that is supposed to run for a long time. Thanks, Nava Carmon -------------- next part -------------- An HTML attachment was scrubbed... Download