* Close down tesseract and free up all memory. End() is equivalent to * destructing and reconstructing your TessBaseAPI. * Once End() has been used, none of the other API functions may be used * other than Init and anything declared above it in the class definition. */
| 2077 | * other than Init and anything declared above it in the class definition. |
| 2078 | */ |
| 2079 | void TessBaseAPI::End() { |
| 2080 | Clear(); |
| 2081 | delete thresholder_; |
| 2082 | thresholder_ = NULL; |
| 2083 | delete page_res_; |
| 2084 | page_res_ = NULL; |
| 2085 | delete block_list_; |
| 2086 | block_list_ = NULL; |
| 2087 | if (paragraph_models_ != NULL) { |
| 2088 | paragraph_models_->delete_data_pointers(); |
| 2089 | delete paragraph_models_; |
| 2090 | paragraph_models_ = NULL; |
| 2091 | } |
| 2092 | if (osd_tesseract_ == tesseract_) |
| 2093 | osd_tesseract_ = NULL; |
| 2094 | delete tesseract_; |
| 2095 | tesseract_ = NULL; |
| 2096 | delete osd_tesseract_; |
| 2097 | osd_tesseract_ = NULL; |
| 2098 | delete equ_detect_; |
| 2099 | equ_detect_ = NULL; |
| 2100 | delete input_file_; |
| 2101 | input_file_ = NULL; |
| 2102 | delete output_file_; |
| 2103 | output_file_ = NULL; |
| 2104 | delete datapath_; |
| 2105 | datapath_ = NULL; |
| 2106 | delete language_; |
| 2107 | language_ = NULL; |
| 2108 | } |
| 2109 | |
| 2110 | // Clear any library-level memory caches. |
| 2111 | // There are a variety of expensive-to-load constant data structures (mostly |
no test coverage detected