Patch proposal for leak in DBD::Oracle when calling 'execute_array' with UTF-8 NLS...

Pierre-Alain Blanc <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.dbi.sybase.devel
Message-ID <[email protected]>

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
leak_in_execute_array_when_using_utf8.patch (text/x-patch, 393 B)
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);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.