Re: Segmentation Violation on FREE?
Posted in 1998
Art S. Kagel <kagel@bloomberg.com> wrote in article > Freeing a statement that is to be accessed by a cursor later is bad > news! The SEGV you are seeing is what usually happens when one tries > this trick. Yes the manuals seem to support this but it bombs almost > everytime. > > Art S. Kagel > Art, I agree with you hundred percent. I personally never use the syntax. I am in a unique situation here, the code is written by some new-bees and I am just brought in to help them tuning the database and application. The program in question prepares about 150 SQL statements within a loop. Bad news I know. I had to get past the core dump last night before I can recommend the code changes since it will be a huge undertaking. Here it what I found and a little puzzled.... The code will run for some time going over the same function that has this syntax sequence; 423 times to be exact (if you care for the numbers). At 424th record it will hit a PREPARE (which was successful before) that prepares a WITH HOLD cursor and core dumps. Here is the puzzling part, the cursor referred by the stmtID has never been used in the code, no open, fetch, close or free. It was a left over from a previous version of the code. I commented the lines out and program runs fine. It may be a memory leak inside Informix library (just a premature guess). I wrote a test program trying to duplicate the sequence with fewer number of statements and ran the program in an infinite loop for about an hour. Could not duplicate the error. I was watching the memory usage whole time and it seems to be constant. I am still scratching my head looking for a logical explanation. Thanks, Raja