I am sort of with Martin on this one as we would like to know why?

At first glace decrementing the reference count like this would not seem to be 
a little overkill as tuples_utf8_av is created with newAV() which should take 
care of that for us.

However looking a little deeper maybe we need to move where we

tuples_utf8_av=newAV();

down into the iteration of exe_count or at least clean it out at that level at 
each iteration. 

Seems the tuples_utf8_av is used just for the exe_count set of tuples not the 
full set of tuples.

Just a few quick thoughts on it.

Any testing I can do will have to wait till tonight when I can get to a UTF8 DB.

Cheers
John


----------------------------------------
> Date: Tue, 9 Oct 2012 08:53:15 +0100
> From: martin.ev...@easysoft.com
> To: blan...@worldcom.ch
> CC: dbi-dev@perl.org
> Subject: Re: Patch proposal for leak in DBD::Oracle when calling 
> 'execute_array' with UTF-8 NLS...
>
> 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                                         

Reply via email to