ColdFusion Application log reports a 'Java heap space' error

I've read that one needs to increase the default "Java heap space" memory.

Would someone tell me exactly how to increase the memory for 'Java heap space', how to get into Java to do so because I cannot seem to find it or how to increase the memory. This Windows 2012 R2 machine has 32 GB of memory and running ColdFusion 11 Enterprise, one instance and IIS 8..5. I've seen reports of this elsewhere but the person doing the explaining assumes far too much. I really need a walkthrough on how to increase the memory.

Then I'll address the issues of what is error that lead to the memory leak in the first place.
Grover McBroomAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

_agx_Commented:
JVM settings are stored in a text file named jvm.config, usually located {cfroot}\cfusion\bin\jvm.config.  Always make a backup copy of jvm.config BEFORE making any modifications. If that file gets corrupted, the CF server may not start. As long as you have a backup,  just overwrite it with the good copy and you're back in business.

Settings can be modified either through the CF Administrator:
CF Admin - JVM Settings

... OR by modifying jvm.config directly with Notepad or WordPad.  The "-Xms" is minimum heap size and "-Xmx" is maximum size.  The default settings for CF11 are typically 256m (or megabytes) minimum and 512m maximum.

Edit JVM Config with WordPad
Keep in mind JVM tuning is a very complex topic and optimal settings depend on a number of factors. For example, the maximum heap size is lower for 32 bit than 64 bit

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Grover McBroomAuthor Commented:
Well, that was easy. For you. Guess I missed the word HEAP when looking through CF Admin settings. So much to learn, too few brain cells to spare, if I even had them.

I imagine with 32 GB of memory, the 256 MB won't be missed. Too bad it does not accept more. We're only using 14%, on the average, of the total 32 GB. Would be nice to put in to work somehow.

Nearly single-handedly, you make ColdFusion bearable, and workable, with all your help!

But I am a bit confused though. The following forum exchange on adobe seems to indicate one can increase the heap size far beyond 512 MB:

https://forums.adobe.com/thread/1027056:
"Yes you can give the JVM more memory if you are only using 1GB out of the 3 GB on your server. I would set the max heap size (in cf administrator) to 1024mb (1gb) instead of 200mb. If you are running 64 bit then you can go above 1gb, but if you are running 32 bit you can't get the max heap. You might consider setting the min heap size equivalent to or just below the max heap size, so you aren't wasting resources shrinking or growing the heap at runtime.  It's also worth noting that the slowness you are experiencing under load may not have anything to do with the heap size. The problem could be on the DB side of things, or elsewhere."

Am I missing something here? Obviously we are running 64 Bit everything, Server and CF.   My CF Admin setting will not take more than 512 MB.
_agx_Commented:
My CF Admin setting will not take more than 512 MB.

Yes, if both the o/s and CF/jvm are 64 bit you should be able to set it much higher.  (32 bit limits are lower).  Exactly what happens when you tried it?

Edit:
I just retested it w/CF11 64bit, and was able to set both the min/max to 4096 (ie ~4 gig) via the CF Admin. CF accepted the new values and restarted w/out issue.  What values did you use?
The 7 Worst Nightmares of a Sysadmin

Fear not! To defend your business’ IT systems we’re going to shine a light on the seven most sinister terrors that haunt sysadmins. That way you can be sure there’s nothing in your stack waiting to go bump in the night.

Grover McBroomAuthor Commented:
So glad I asked. Goes to show I'll never be president, or a master programmer; I set the minimum but ignored the maximum. Dah!

So, I experimented and set both to 16384 and reset CF Application Service. With 16 GB for the Heap, that should do something, or possibly nothing. If that large amount is a danger when I do have 32 GB available, let me know. If I still get the same errors as before that free ColdFusion, then I'll back off to a more reasonable min/max for the heap.

Thanks again for clearing this up. I have not seen this explained so well anywhere else.
_agx_Commented:
Well,  like I mentioned before tuning is a complicated topic and not my exact area of expertise.  However, going from 512M to 16G is quite a big leap :)  Might want to start a bit smaller like 4G or 8G and go from there.  Obviously the more RAM that's allocated to CF, the less is available for anything else on the system.  If you're not certain how much memory CF actually requires it might end up being wasted.  ie If CF only uses 6G, but you've allocated 16G, then the remaining 10G is essentially wasted.

IIRC, larger heap may also affect GC's (garbage collections). There's two types of GC: minor and major ie "Stop the world" events.  In some cases, frequent major collections can cause delays.  Newer jvm's tend to do a better job with GC's... but again, it's a complicated topic.  Profiling would give you a more accurate picture.
Grover McBroomAuthor Commented:
Got it. Will take your advise. Thanks.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ColdFusion Language

From novice to tech pro — start learning today.