# Report Memory Errors

You can report memory leaks and memory overwrites in the log file by enabling the memory trace system, either by using the API or environment variables. If the memory trace system is enabled, the error messages for memory leaks and memory overwrites (`KVError_MemoryLeak` and `KVError_MemoryOverwrite`, respectively) are reported in the log file when they are generated. The error messages are listed in Error Messages.

NOTE: To report memory overwrites, you must also set a memory guard. See Specify a Memory Guard.

## Use the API

To enable or disable the memory trace system in the API, instantiate the Filter object using the constructor `Filter(java.lang.String outputCharSet, long filterFlags)`, and set the `filterFlags` argument to either `FILTERFLAG_OOPMEMTRACEON` or `FILTERFLAG_OOPMEMTRACEOFF`. For example:

    objFilter = new Filter(outputCharSet, Filter.FILTERFLAG_OOPMEMTRACE);

## Use Environment Variables

To enable the memory trace system, add the `KVOOPMT` environment variable, and set its value to `1`. To disable the memory trace system, do not set the `KVOOPMT` environment variable .

_FT_HTML5_bannerTitle.htm