OutOfMemoryException with large OneNote files

Hello dear Aspose team,

We keep getting out of memory exceptions when loading large files (with Aspose.Note 23.11). The following file causes exception in both of our 32-bit and 64-bit builds

The following 3 files cause OutOfMemory exceptions only in 32-bit (x86) builds.

How we load and process large files?

P.S. We found the issue where it is claimed that 23.11 is capable of loading large One Note files (Loading Big One note file giving System.IoExcepption - #3 by amjad.sahi), however, based on our research, it still can’t load the files that are attached to this post.

Best, Vahe.

@vahem,

I did test your scenario/case using your OneNote files. I found an exception “System.IO.EndOfStreanException” when loading “OutOfMemory4.one” file via Aspose.Note for .NET v23.11. Do you find this exception on your end? For other files, it works fine. I use VS.NET 2022, Windows11 (64-bit OS, x64-based processor) with 8GB RAM.

@amjad.sahi Thanks for checking. No, as I mentioned above

  • OutOfMemory4.one file is throwing OutOfMemory exception in any application.
  • Other files throw OutOfMemory exception in 32-bit (x86) applications. I’m not 100% sure about OutOfMemory2.one file, but OutOfMemory1.one and OutOfMemory3.one always throw OutOfMemory exception on my end.

Here is a sample app which I use to reproduce the issues

You can run x64 version by choosing “Any CPU” from Visual Studio and you can run x86 version by choosing “x86” from Visual Studio.

Best, Vahe.

@vahem,

Thanks for the sample project with sample documents.

I was able to reproduce the issue as you mentioned by using your template files. I got OutOfMemoryException with the large OneNote files when loading into Aspose.Note object model when running especially 32-bit build.

We need to evaluate your issue in details. We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): NOTENET-5819

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

@amjad.sahi, any update on this?

@vikram.venugopal,

We are sorry, but your issue has not been resolved yet. We will evaluate if we can provide you with the latest updates or a possible ETA on it. Hopefully, we will get back to you soon.

@amjad.sahi Could you please confirm if there has been any progress?

@LinkTek1,

We will provide updates on it soon.

@LinkTek1, @vahem, @vikram.venugopal,

We have thoroughly reviewed your original code segment.

We do not see any need to use additional streams as per your code segment. It appears that using streams and then copying them may lead to mixing of things, which could potentially cause an OutOfMemoryException. Additionally, you are transferring the data multiple times, which may add extra settings or other factors, potentially affecting the streams. Since you have physical files, streaming and copying may not be necessary, so you should simply load the files from the file path, and Aspose.Note will work seamlessly as we have tested.
Please update the custom LoadFileWithAsposeNotes method as follows:

 static void LoadFileWithAsposeNotes(string path)
 {

     try
     {
         var doc = new Aspose.Note.Document(path);
         Console.WriteLine($"Successfully loaded {path}");
     }
     catch (OutOfMemoryException ex)
     {
         Console.WriteLine($"Out of memory exception with {path}");
     }
     catch (Exception ex)
     {
         Console.WriteLine($"Exception with {path}. Message = {ex.Message}");
     }
 

    
 }

It will work for OutOfMemory1.one, OutOfMemory2.one, and OutOfMemory3.one documents. For OutOfMemory4.one, we checked and it is somehow corrupt or damaged, even the OneNote app cannot open it. So, Aspose.Note cannot load OutOfMemory4.one document.