How come JDB_Fetch on a BLOB column doesn't leak memory?

jolly

VIP Member
How come JDB_Fetch on a BLOB column doesn\'t leak memory?

Hi All,

I'm writing a BSFN to copy rows (including a BLOB column) from one OW table to another. Looking into the code, JDB_Fetch fills in an uninitialised BLOBVALUE with a pointer to the BLOB data and it's length. Therefore JDB_Fetch must have allocated the memory to hold the BLOB data. However in various examples of code within OW that does this, there never seems to be a free of the BLOB data that JDB_Fetch allocated. Where does it get freed? How come loops that do this don't leak like crazy?

Just curious...

Cheers,
JohnO
 
Re: How come JDB_Fetch on a BLOB column doesn\'t leak memory?

Hi JohnO!

I write BSFN to store bitmaps in F55 table for automatic printing. I use JDB_Fetch and JDB_Insert to work with BLOBs. No problems so far with memory. Its look like BLOBs processed specially. It is malloc 'ed in JDB_Fetch and stored in memory till the end of BSFN. Before the malloc in JDB_Fetch it might be free memory from previous Fetch. Something like if (record.lpValue !=NULL) {free(record.lpValue)}
 
Re: How come JDB_Fetch on a BLOB column doesn\'t leak memory?

Ah - I hadn't thought of that. It must store a reference to the alloc'd memory somewhere in the BhvrCom. That way it could do a garbage collection when the BSFN exits

Thanks,
JohnO
 
Back
Top