Not enough storage is available to complete this operation: E_OUTOFMEMORY

Error message “not enough memory/storage...” may appear in following cases :

• Processing multi-page documents

100-page document is considered as a quite large document. 100 ImageDocument and Layout objects may use up to 2 Gb or more in virtual memory (and 300-400 Mb are required  for FineReader Engine itself)

We recommend the following settings for minimizing memory usage:

IFRDocument::PageFlushingPolicy = PFP_FlushTo Disk 
IPrepareImageMode::ImageCompression = IC_Compress
IPrepareImageMode::KeepOriginalCoordinatesInfo = false (starting from FRE11 R5)

By default, temporary objects are stored in "%TEMP%/FREngine 12" folder. Use frDocument.TempDir property to change the temporary folder before calling frDocument.AddImageFile() method. The folder must already exist in the filesystem.

If you use PageFlushingPolicy = PFP_FlushToDisk, then make sure that you have enough free space on disk. For the 100-page document, we recommend 5-10 Gb free on the disk, where temp folder is located.

• Accessing sub-objects

In programming environments with automating garbage collection, using language constructions such as object0.subobject1.subobject2. … .subobjectN may lead to memory leak. The recommended approach is splitting such chains:

SubObject1Type object1 = object0.subobject1
SubObject2Type object2 = object1.subobject2 ...

In the end, when you don’t need these objects, they should be set to null.

• Deinitializing Engine periodically

Sometimes deinitializing Engine after processing batch of documents complete prevents memory issues. For example, you may call deinitialize Engine and initialize it again every 1000 images.

For .NET, our developers recommend calling GC.Collect, GC.WaitForPendingFinalizers before the DeinitializeEngine() method call and after processing each FRDocument. You may also call Marchal.ReleaseComObject for all objects.

Was this article helpful?

1 out of 4 found this helpful

Have more questions? Submit a request

Recently viewed