We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Receiving out of memory errors upon initialization

A small number of our clients are reporting that they’re receiving out of memory errors when using our product. While it’s rare, only affecting a couple of clients, it happens consistently for them.





It appears that the out of memory errors are happening when we try to initialize an Aspose license object. Sometimes it happens when initializing the license object for Aspose.PDF, and sometimes for one of Aspose.Words, Aspose.Cells, or Aspose.Slides. The machines it is happening on appear to have adequate memory (example: a desktop machine with 8 GB physical memory and around 5 GB free when the error occurs).



It is possible that there are two or more Aspose.PDF licenses getting initialized during our process - would this potentially cause any problems? Is there anything else that might be the cause of this? No documents are actually being loaded into memory when the errors are thrown, so it can’t be document size - it’s clearly coming from when we try to initialize the license object.



These problems only recently started appearing, as well, and I have not tried going back to a previous version to see if it works, as we haven’t been able to reproduce the issue in-house so I can’t easily check if rolling back will help (the client that’s most vocal about the problem is also very grumpy and basically won’t help us debug our issues beyond complaining that “it happened again”). We also recently updated our license (mid-March), but I hope that doesn’t have any possibility of being the problem.





Is there any guidance you can provide on this at all, by any chance? I don’t know what else to look into at this point, so any information on perhaps memory requirement differences between Aspose.PDF 8.* and 9.* or something like that might help.





Thanks,

Michael Whalen

I just receive some new information that may be the cause of this problem. It appears that our clients are running our application as an Outlook add-in (that’s expected) while have very many (greater than 20) pst files loaded into memory along with a bunch of other add-ins loaded and such. They’re running the 32 bit version of Outlook, so it’s very likely they’re using up all of the 4 GB that a 32 bit application gets to use.

We’re looking into that, and if that’s the case, I’m not sure if there’s anything you can do to help. If you do have any tips on memory usage, they’d be welcome, but right now it looks a lot like the problem is someone running Outlook in a way that we really didn’t anticipate.

Hi Michael,


Thanks for contacting support.

I would like to answer from Aspose.Pdf perspective. Please note that license initialization for this API do not produce OutOfMemoryException and you do not need to instantiate license again and again in your application. Please note that Aspose.Pdf for .NET initializes the license when first instance/object of Aspose.Pdf for .NET is created and its recommended to place the license initialization code in some static method which is executed once at that start of application. There is no need to re-initialize the license in multi-threaded environment when a new thread is created. The license is valid until the main application thread is running.

May be you can place the license initialization code in Main(), Page_Load() or any method which is executed at the start of application. We are sorry for your inconvenience.
Hi Michael,

Thanks for your inquiry. I would like to answer your query from Aspose.Words perspective.

As my colleague has shared that license initialization does not throw the OutOfMemoryException. It would be great if you please share following detail for investigation purposes.

  • What environment are you running on?
  • OS (Windows Version or Linux Version)
  • Architecture (32 / 64 bit)
  • .NET Framework version
  • Please attach your input Word document.
  • Please create a standalone/runnable simple application (for example a Console Application Project) that demonstrates the code (Aspose.Words code) you used to reproduce this exception.

As soon as you get these pieces of information to us we'll start our investigation into your issue.

As I mentioned in my second post, I now believe that it really is the situation where our clients are actually using up all of the memory allowed for a 32 bit application, so I don’t think any further investigation by you is necessary. If there are any tips for handling memory management with respect to your various products, I’d be interested in seeing them.



Also, while it’s been mentioned that there is no need to re-initialize an Aspose license object, I was more curious about whether there are any problems that might arise if they do get initialized more than once. I do have the license initialization code in static methods that will only be run once; however, there are two places that might initialize the Aspose.PDF license object, and I was wondering if that might cause problems.



If I get more information from one of our clients that indicates something different, then I will follow up on this.



As for coming up with a simple application that replicates the issue - that’s pretty much impossible, as the complexity of the scenario is directly responsible for the problem: any simplification will remove the issue. We haven’t even reproed it in-house yet - we only have reports from clients who’ve seen the issue. That’s why I’m looking more for general advice on how the license objects work and if there are any general tips or tricks for managing memory used by Aspose that might help out with this issue. No worries if there isn’t anything like that - I’m just trying to cover all possibilities to try and solve our issues.



Thanks,

Michael Whalen

Hi Michael,


Thanks for sharing the details.

As far as Aspose.Pdf for .NET is concerned, there is no harm in initializing the license more than once when accessing the license from system using path string. However, when using Stream to load the license, there might be problems while loading the license because the license should be released by one stream so that it can be loaded into new Stream instance. But still, loading of license does not produce OutOfMemory error.

In case we can be of any further assistance, please feel free to contact.