# DeleteItem

Deletes an item.

### Synopsis

`Err DeleteItem( Item i )`

### Description

This procedure deletes the specified item and frees any resources (including memory) that were allocated for the item.

Note: There are convenience procedures for deleting most types of items (such as `DeleteMsg()` to delete a message and `DeleteIOReq()` to delete an I/O request). You should use `DeleteItem()` only if you used `CreateItem()` to create the item. If you used a convenience routine to create an item, you must use the corresponding convenience routine to delete the item.

### Arguments

i
  Number of the item to be deleted.

### Return Value

The procedure returns a value greater than of equal to 0 if successful or an error code if an error occurs.

### Implementation

SWI implemented in kernel folio V20.

### Associated Files

item.h
  ANSI C Prototype

### Notes

The item number of a deleted item is not reused. If a task specifies the item number of a deleted item, the kernel informs the task that the item no longer exists.

Tasks can only delete items that they own. If a task transfers ownership of an item to another task, it can no longer delete the item. The lone exception to this is the task itself. You can always commit sepaku.

When a task dies, the kernel automatically deletes all of the items in its resource table.

### See Also

``CheckItem`(), CreateItem(), DeleteIOReq(), DeleteMsg(), DeleteMsgPort(), DeleteThread(), exit()`

#