Out of memory
Added by Tuan Tran over 4 years ago
We have a very small C# project references the following 2 libraries.
- saxon9he.dll
- saxon9he-api.dll We are using these to help with XSL Transform.
After a few weeks of running, the program failed randomly with out of memory error. I've read that JVM heap memory needed to be increase. But, C# does not deal with JVM, I think.
These are a couple of errors we ran into.
- The type initializer for 'java.nio.charset.StandardCharsets' threw an exception.Exception of type 'System.OutOfMemoryException' was thrown
- The type initializer for 'net.sf.saxon.functions.StandardFunction' threw an exception.Exception of type 'System.OutOfMemoryException' was thrown ...
I really appreciate any help. Thanks,
Replies (2)
RE: Out of memory - Added by Michael Kay over 4 years ago
It's very hard for us to say much about this without full details of what you're doing, and I appreciate that that's very difficult to provide when the failure occurs after weeks of running.
The last Saxon release to contain the class StandardFunction
was 9.7, so you're not up-to-date with the latest releases. I'm not saying that upgrading will make the problem go away, but it will certainly make it easier for us to help you. We definitely need to know which release you are actually using!
It's surprising that the static initializer for a type should throw an OutOfMemoryException after several weeks of running, because we would normally expect that static initializers are called only the first time a particular class is used. This suggests to me that there's something odd about the structure of your application.
If the amount of memory used by an application is steadily increasing over a period of weeks, then the best diagnostic strategy is to get a heap dump to find out what objects are using the memory. I have more experience doing this in Java than in .NET, but perhaps the links in https://stackoverflow.com/questions/2957105/how-can-you-explore-the-managed-heap-in-a-net-application-to-identify-possible are useful. Ideally get a sequence of dumps to see how the memory occupancy is changing over time.
Failure to release memory can of course be happening either within the Saxon internals, or at the level of the user application.
RE: Out of memory - Added by Tuan Tran over 4 years ago
Thanks for the quick response, Michael. I'll upgrade the libraries to see if it helps. If not, I'll provide the C# source code.
From: Saxonica Developer Community
Sent: Monday, March 16, 2020 9:37 AM
Subject: [Saxon - Help - msg7777] RE: Out of memory
Please register to reply