Menu

#1024 Out of Memory When Saving Imported Images into PDF

5.X
open
nobody
None
6.1.2.25834
Support
High
N/A
2023-07-17
2023-07-16
Jay Kole
No

I have been trying to create a PDF from imported JPGs.
Each jpg is around 7.5mb on average, and there are 470 of them.
After it gets to the 18th image (a total of 147mb at that point) it gives an out of memory error.
If I just select the first 18 images it created the pdf just fine, but if I add the 19th it errors out.

Here is the error info that is given:


System.AggregateException: One or more errors occurred. ---> System.OutOfMemoryException: Out of memory.
at Microsoft.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at Microsoft.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccess(Task task)
at NAPS2.Scan.Images.ScannedImageRenderer.<rendertostream>d__6.MoveNext()
--- End of inner exception stack trace ---
at Microsoft.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at Microsoft.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccess(Task task)
at NAPS2.ImportExport.Pdf.SavePdfOperation.<>c__DisplayClass9_0.<<start>b__2>d.MoveNext()
---> (Inner Exception #0) System.OutOfMemoryException: Out of memory.
at Microsoft.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at Microsoft.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccess(Task task)
at NAPS2.Scan.Images.ScannedImageRenderer.<rendertostream>d__6.MoveNext()<---</rendertostream></start></rendertostream>


Thanks in advance,
Jay

Discussion

  • Jay Kole

    Jay Kole - 2023-07-16

    Thanks for promptly getting back on this.

    Since I am running WinXP sp3, I am not able to try the beta version.
    Running 3GB of RAM
    Images are 8720x6808

    So the amounts for Private Bytes and Working Set being shown in Task Manager/Process Explorer fluctuates while the process is occurring.
    The highest, before the crash, the Private Bytes gets to 950,024K and Working Set gets to 839,480K.
    After the crash they are 640,668K and 525,844K respectively.
    After closing the error message they are 62,388K and 49,832K respectively.

    Thanks again.

     
  • Jay Kole

    Jay Kole - 2023-07-17

    I can try smaller JPGs.
    What should be the JPGs' max size I use?

     
  • Jay Kole

    Jay Kole - 2023-07-17

    I decided to do a test with the images being 50% smaller. So sizes were 4360x3404 at 2.2MB.
    Got to 126 images (253MB total) this time, and the memory interesting climbed to 1,358,132K for the Private Bytes and 1,160,028K for the working set.

     
  • Jay Kole

    Jay Kole - 2023-07-17

    Another I noticed is that when you quit the program (even with no crash) it doesn't get removed from the Task Manager - it stays loaded. And if I start the program again it creates a new instances. So if I keep closing and opening the program it results in more and more instances being loaded in the Task Manager.

     
  • Jay Kole

    Jay Kole - 2023-07-17

    If you want, I can create a new ticket to address the "many instances" issue.

     
  • Jay Kole

    Jay Kole - 2023-07-17

    This time I tried a test with the images being 25% smaller. So sizes were 2180x1702 at 600K.
    Completed the task, getting all 470 images (274MB total). The Private Bytes got to 1,309,164K and the Working Set got to 1,140,584K.
    But sadly at this size the images are very poor :(

     
  • Jay Kole

    Jay Kole - 2023-07-17

    Oh, that is disappointing to hear.
    So basically with the WinXP version a person is stuck with making PDFs that are under 300MB?
    I guess that explains why when I tried to import a 700MB pdf a few days ago it crashed. I thought it was an issue with the PDF itself.

    I really hope you would reconsider, and at least fix this 300MB limitation - as I'm sure you will agree that is quite low.

    Regardless, thank you for your time and help thus far - and also the very rapid responses!

     
  • Jay Kole

    Jay Kole - 2023-07-17

    Great solution idea! Not the most elegant - but it works!
    I did the 50% JPGs (doing 470 files 15 at a time didn't sound fund, but doing 100 at a time seem more manageable).
    I ended up using a different merging program called PDF Merge Tool (also on SourceForge).
    PDFSam was acting super buggy. If I de-maximized the screen and moved it to my other monitor, when I re-maximized it it would lock up. When I didn't do that and just tried the program when I clicked the merge button it immediately went up to 100%, but it just created a 0KB buffer file.
    But the PDF Merge Tool worked just fine.

    So again, thank you for the suggestion!

     
  • Jay Kole

    Jay Kole - 2023-07-17

    I fully understand your position. I've stayed with XP due to being used to the workflow (I have it looking and working like Win2K).
    I tried to make Win7 look/work like Win2K, but wasn't able to sadly (got close, but the explorer boxes wouldn't behave).

    I hate change just for the sake of change, and I feel MS did just that (Win8 getting rid of Start button for a well known, and hated, example). I just don't like the idea that the steering wheel in my car appearing in different locations, or swapping where the gas and brake pedals are).

    But one could argue that's a "me issue", and fair enough. I'm sure my OCD fuels this as well.
    Not a fan of needless learning-curves.

    But back to the actual topic....
    Thank you so much again for all your time and help with this!

     

Log in to post a comment.