Re: CLOSE and FREE
Posted in 1995
Topics: Connectivity: ESQL/C, 4GL & Embedded SQL
>> In article <D203p4.FGq@cix.compulink.co.uk>, >> akent@cix.compulink.co.uk ("Andy Kent") wrote: >> > Can anyone offer an explanation of what the CLOSE and FREE statements >> > actually do, in terms of what each one frees up. >> ... and why I should use them, >> ... and why there isn't a FREE imbedded inside CLOSE (if FREE is a Good >> Thing) >> ... and what happens if I FREE without CLOSEing first. >> ... and how much resource (memory?) does FREE free? >> I asked all these questions of Informix NZ about 6 months ago, but the guy >> really had no idea what the answers were. Neither do I CLOSE closes a cursor. It can then be opened again using OPEN. FREE frees any memory allocated for the cursor and you cannot OPEN it again. If you just CLOSE all of your cursors, Informix will not free the memory allocated to that cursor unless you also FREE it. But FREE is not included in CLOSE so that you can OPEN again. I don't know what happens if you FREE before CLOSEing.... FREE is very useful in long-running programs that use lots of cursors. I have not found it to be very useful in 4GL programs because cursor names are static. But in ESQL/C, where you can dynamically name and create cursors, it is very useful. Joe DeNicola