Christopher G Tantalo wrote:

>>My understanding was that since the $hSql was declared local to the
>>while loop, it would be released at the end of the loop. If this is not
>>the case, or not the case with DBI/DB2 then that would certainly explain
>>my error.
>>
>>Shawn
>>    
>>
>
>You are right in saying that it is declared locally to the while loop, but since
>you never exit it, it doesn't go out of scoop to get released.
>

Cristopher,

Thanks for your response.


My understanding (albeit from a C++ perspective) is that the variable is 
deleted at the end of the while. I have assumed that since I declare the 
variable

my $hSql = ...;

that I would be creating a new $hSql variable and since nothing is 
accessing the old one it would be deleted.


As a test I move the statement code to a function

my $Handle = DBI->connect('dbi:DB2:DBPRC001', 'sdevlin', 'gwybodaeth', 
\%parameterHash);
while (1) {
    TestCall();
    sleep(1);
}

sub TestCall {
    my $sql = 'select SECURITY_SYMBOL, TASK_STATUS_DETAIL from 
dbprc001.T4030TASK where TASK_ID = ?';
    my $hSql = $Handle->prepare($sql);
    $hSql->execute(12);
    $hSql->finish();
}

I still get the memory leak with this code.


Shawn

-- 
This communication is intended to be received by the individual or
entity to whom or to which it is addressed and it contains information
that is privileged, confidential and subject to copyright of 
Recognia Inc. Any unauthorized use, copying, review or
disclosure is prohibited. If received in error, please contact me by
phone at 613-623-6159 or by email at mailto:[EMAIL PROTECTED].



Reply via email to