Deinitialization
After the Document Reader SDK is initialized and running, it may consume a certain amount of megabytes. In most cases, once the processing of identity documents is finished, there is no need to keep the Document Reader SDK in memory. If the app operates in the background and consumes excessive memory, the operating system can kill it.
Deinitialization is akin to tidying up after you've completed your work with the Document Reader SDK. It guarantees that your application doesn't leave any resources in the device's memory. However, there are a few resources that cannot be released and will remain in memory.
To prevent excessive memory consumption, you need:
- Initialize the Document Reader SDK.
- Perform processing of identity documents, handle processing results.
- When finished using the Document Reader SDK, deinitialize it.
To deinitialize Document Reader SDK, use the following method:
DocReader.shared.deinitializeReader()
[RGLDocReader.shared deinitializeReader];
DocumentReader.Instance().deinitializeReader()
DocumentReader.Instance().deinitializeReader();
DocumentReader.instance.deinitializeReader();
DocumentReader.deinitializeReader(s => { }, e => { })
DocumentReader.deinitializeReader()
DocumentReader.deinitializeReader(function (s) { }, function (e) { })
// Android
DocumentReader.Instance().DeinitializeReader();
// iOS
RGLDocReader.Shared.DeinitializeReader();
That's it. By doing this, you will free up the consumed by the Document Reader SDK memory and won't experience unexpected crashes.