Reduce database memory by detaching a memory device.
MCO_RET mco_db_detach_dev_ctx(
/*IN*/ const char *db_name,
/*IN*/ mco_device_t *dev,
/*IN*/ const void *context
);
db_name
dev
mco_device_t structure describing the memory device to detach. Only devices with assignment = MCO_MEMORY_ASSIGN_PIPE_BUF are supported.context
This function reduces the available memory of an opened database by detaching a previously added memory device. It is typically used to release unused memory segments when system resources need to be reclaimed.
The function:
- Establishes a temporary internal connection to the database,
- Acquires exclusive locks on the transaction manager and database header to ensure consistency,
- Detaches the specified memory device using
mco_int_detach_dev(),- Invokes a detach callback if the operation completes immediately (i.e., not deferred),
- Cleans up the temporary connection.
Important: Only devices assigned as
MCO_MEMORY_ASSIGN_PIPE_BUFcan be detached. Attempting to detach other device types will result inMCO_E_UNSUPPORTED.If the device contains active allocations, the detachment may be deferred until those objects are freed (indicated by return code
MCO_S_DEFERRED_DELETE).
MCO_S_OK
MCO_S_DEFERRED_DELETE
MCO_E_UNSUPPORTED
MCO_MEMORY_ASSIGN_PIPE_BUF.