This article is designed to help you get a better understanding about ColdFusion OutOfMemory exceptions and what causes them.
What causes OutOfMemory errors?
There are a variety of different scenarios that could lead to an OutOfMemory error occurring within your ColdFusion service. Listed below are some of the more common causes we’ve seen for OutOfMemory exceptions.
Session scope. Sometimes the combined size of all sessions can be several GB in size and can consume all available Java memory.
Session size. Try to avoid putting very large objects into the session scope.
Session duration. We usually recommend a default session of about twenty minutes and a maximum session of one hour.
Bots. Don’t give bots a full session in your application(s). Bots usually don’t handle their session properly and will generate a new session each time they request a new page.
Scope choice. If the information that you’re retaining isn’t specific to the user or session, then you may be able to utilize a different persistent scope such as the application scope.
Query cache. In most cases query caching is a great and can greatly improve the performance of your application(s). One thing to keep in mind is that if you have a common query with numerous variations, each variation that is used will be cached.
One large query. This could be a malformed query that returns much more data than expected.
Undersized Java heap space. Some applications simply keep more objects around in memory and require a larger Java heap.
A ColdFusion or Java bug. Every now and then, a ColdFusion or Java bug can cause OutOfMemory issues.
Due to this, we strongly recommend that you keep your ColdFusion instance(s) up to date with the latest updates from Adobe. If needed, we can help you apply any available updates.
If you believe that your ColdFusion service has been experienced OutOfMemory exceptions please feel free to contact our support team and we’ll be happy to help you identify and resolve the causes of these incidents.