# Documentedit

API documentation
Documentation for this module is on the documentedit wiki page.

## Memory handling

### Used OOM policies

All functions in DocumentEdit that can fail with OOM returns an OpStatus value to indicate failure. The LEAVE/TRAP mechanism is not used.

### Who is handling OOM

OOM handling is not complete and doesn't report all situations when OOM occurs. It handles them without crashing but this is not yet tested. This hasn't been prioritized yet because the API hasn't stabilized yet and the target is desktop.

### Description of flow

No flow

### Heap memory usage

Some

It uses temp buffers in the `GetTextHTML()` functions.

### Stack memory usage

Some

### Static memory usage

Some

### Caching and freeing memory

Undo/Redo stack

### Freeing memory on exit

We free everything

### Temp buffers

DocumentEdit does not use the shared temp buffers in `MemoryManager`

### Memory tuning

The UNDO-stack will only keep up to a specified amount of memory per editable document. This can be finetuned by changing MAX_MEM_PER_UNDOREDOSTACK.

### Tests

none

### Design choices

Some

### Suggestions of improvements

none