Free LO file descriptors

An LO file descriptor exists until one of the following conditions occurs:
  • You explicitly close a smart large object with the mi_lo_close() function.

    When mi_lo_close() closes a smart large object, the associated LO file descriptor is freed.

  • The database server implicitly closes any open smart large objects at a session boundary (when the current database or connection closes).

    The resources that an open smart large object uses get automatically released at the end of a session. However, LO handles get released based on their memory duration.

The effect of closing the LO file descriptors of a smart large object depends on whether the smart large object is permanent or transient:
  • Closing a permanent smart large object

    When you close all its LO file descriptors, a permanent smart large object (one that is referenced by at least one column) remains allocated. The database server does not delete the data until the reference count is zero.

  • Closing a transient smart large object
    However, when you close the last LO file descriptor for a transient smart large object, the database server marks the smart large object for deletion because both deallocation conditions are true:
    • The reference count of the transient smart large object is zero.

      The reference count of any transient smart large object is zero because it has no LO handles stored in the database.

    • No LO file descriptors exist for the transient smart large object.

      After you close the last open LO file descriptor (explicitly or implicitly), no more references to this smart large object exist, and the data is not kept.