# mco_db_kill
RT

> Remove a shared memory segment associated with a database.

### Prototype

        MCO_RET	mco_db_kill(	/*IN*/ const char * dbname);

### Arguments

dbname | The name of a database that was established in shared memory by a previous call of `mco_db_open()`

### Description

> This function removes the shared memory segment allocated by the runtime for the database identified by the `dbname`. It also removes `dbname` from the registry. Use this function to clean up orphaned shared memory allocated by the runtime when necessary. The function does not do any harm if the specified shared memory segment and registry entry do not exist.

> Attention! If the data segment is "killed" during a database session, the results are unpredictable, but always disastrous.

### Return Codes

MCO_S_OK | The shared memory was dismantled successfully

### Example

        Application snippet:

        const char * dbname = "SimpleDb";

        int main(int argc, char* argv[])
        {
            mco_db_h db;
            MCO_RET rc;
            mco_device_t       dev;
            mco_db_params_t    db_params;
            ...

            if( (rc = mco_runtime_start()) != MCO_S_OK)
                exit(-1);

            rc = mco_db_kill( "SimpleDb" );

            if ( MCO_S_OK != rc )
            {
                rc = mco_db_open_dev( dbname, simpledb_get_dictionary(), &dev, 1, &db_params );

                ...
            }
        }

### Files

Header file:
mco.h
Source file:
mcodb.c
Library:
libmcolib.a