Oraperl memory

From: Frank O'Carroll [temporary] <ocarroll_at_icot.or.jp>
Date: Mon, 2 Aug 1993 07:13:45 GMT
Message-ID: <OCARROLL.93Aug2161345_at_ss151.icot.or.jp>


Hi. I am a new user of oraperl/perl and I seem to have a memory allocation bug.

I compiled oraperl and it seems to work fine.

However, if I run the program examples/bind.pl in the oraperl distribution, and give it a very large input file, the memory space used by the oraperl process keeps increasing ... try this:

        oraperl examples/bind.pl < /usr/dict/words > /dev/null &

And use ps to watch the memory use of the process. On my machine it increases until I get a huge (130MB) process which I can't even kill -9.

Do others have this problem or am I using oraperl wrongly or have I installed it wrongly?

I guess &ora_close()-ing the cursors after each bind would fix things, but then what is the point of bind when you could use perl's strings to recompose the query each time?

The system is

        SunOS Release 4.1.1-JLE1.1.1RevB Perl says its version is:

        $RCSfile: perl.c,v $$Revision: 4.0.1.6 $$Date: 91/11/11 16:38:45 $
        Patch level: 19

Oraperl says its version is:

        This is Oraperl, version 2, patch level 4.

        Debugging is not available.
        Default fetch row cache size is 5.
        Empty bind values are replaced by a space.
Oracle version is
        ORACLE RDBMS V6.0.33.2.1, transaction processing option  - Prod A3.4.2J
        PL/SQL V1.0.33.1.1  - Prod A3.4.2J

Here is the program. Of course I have suitable definitions for the tables accessed:
SQL> describe telno

Name                            Null?    Type
------------------------------- -------- ----
NAME                                     CHAR(30)
PHONE                                    CHAR(30)


---------------cut here-------------------------------------------------------
#!/usr5/ocarroll/bin/oraperl
#
# bind.pl
#

# This shows how the ora_bind function may be used to implement a # simple lookup script.

$ora_debug = shift if $ARGV[0] =~ /^-#/;
$lda = &ora_login('', 'frank', 'frank')

        || die $ora_errstr;
$csr = &ora_open($lda, 'select phone from telno where name = :1')

        || die $ora_errstr;

while(<STDIN>)
{

        chop;
        &ora_bind($csr, $_)     || die $ora_errstr;

        # Note that $phone is placed in brackets to give it array context
        # Without them, &ora_fetch() returns the number of columns available

        if (($phone) = &ora_fetch($csr))
        {
                print "$phone\n";
        }
        else
        {
                die $ora_errstr if $ora_errno;
                print "unknown\n";
        }

}

&ora_close($csr);
&ora_logoff($lda);

---------------cut here-------------------------------------------------------

Frank O'Carroll
ocarroll_at_mri.co.jp
ocarroll_at_ss151.icot.or.jp Received on Mon Aug 02 1993 - 09:13:45 CEST

Original text of this message