Re: Patch proposal for leak in DBD::Oracle when calling 'execute_array' with UTF-8 NLS...
"Martin J. Evans" <[email protected]>
| Newsgroups | gmane.comp.lang.perl.modules.dbi.sybase.devel |
|---|---|
| Organization | Easysoft Limited |
| Message-ID | <[email protected]> |
On 08/10/12 13:46, Pierre-Alain Blanc wrote: > > > Hello, > > I've had a problem when using 'execute_array' to insert (lots of) > records with DBD::Oracle (version 1.50): the script consumed too much > memory and finally crashed (killed by kernel). I tried to trigger the > garbage-collection with some code rewrite but it didn't help. But if > I told Oracle *not* to use an UTF-8 charset (changing NLS_LANG from > (for example) "german_germany.utf8" to "german_germany.we8dec"), the > problem disappeared. > > After some investigations, I think the leak is in > 'ora_st_execute_array' method of dbdimp.c. Please find the patch as > attachment. As I'm completly new to writing C for Perl, it may be > something I did not understand or did not correctly fixed. Sorry if > it would be the case. > > Thanks & best regards, Pierre-Alain Blanc > > Thanks for looking into this. The patch: Index: dbdimp.c =================================================================== --- dbdimp.c (revision 15435) +++ dbdimp.c (working copy) @@ -3839,6 +3839,7 @@ } Safefree(phs); Safefree(utf8_flgs); + SvREFCNT_dec(tuples_utf8_av); /* Store array of bind typles, for use in OCIBindDynamic() callback. */ imp_sth->bind_tuples = tuples_av; imp_sth->rowwise = (columns_av == NULL); looks good but it does not explain how changing chrset made the problem go away. Perhaps you could give me a better idea of what you were doing then I can replicate and test it. Martin -- Martin J. Evans Easysoft Limited http://www.easysoft.com