Answered
Java Heap OutOfMemory and GC
We have two applications on the same server - one uses an
Oracle data source and the other a SQL Server source. When the
Oracle app runs, it uses heap space but GC periodically runs and
gives back memory. However when the SQL Server app runs, the heap
holds on to more and more memory until it runs out of space.
These two apps run very similar code but simply point to different data sources. I have read many forum entries regarding OutOfMemory errors but this may be different because even if the code doesn't allow memory to be freed, the heap is eventually freed when CF times out and figures the app is gone (the standard 20 minute timer). That happens with the Oracle app but not the SQL Server app. Even when the "Session Timeout" variable is reached the heap memory is still held. The only way to recover that memory is by restarting CF.
This is a RedHat AS 4 Linux machine and it happens with both CFMX7 and CF8 in single server format. I've watched the memory charts with CF8 (very cool) and you can see the peaks and valleys for the Oracle run but the SQL Server app grows and grows.
I have turned on Heap logging and watched several Young GC iterations followed by a Full GC. That pattern continues while the Oracle app is running. However the SQL Server app starts like that but as time goes on it resorts to only Full GCs until it gets to the "GC time is exceeding GCTimeLimit of 98%" errors and "java.lang.OutOfMemoryError: Java heap space" errors.
So my questions are: given that the apps run differently on the same machine, could there be a difference between the Oracle and SQL Server data sources and why doesn't CF ever find the application is gone and give back some heap space?
These two apps run very similar code but simply point to different data sources. I have read many forum entries regarding OutOfMemory errors but this may be different because even if the code doesn't allow memory to be freed, the heap is eventually freed when CF times out and figures the app is gone (the standard 20 minute timer). That happens with the Oracle app but not the SQL Server app. Even when the "Session Timeout" variable is reached the heap memory is still held. The only way to recover that memory is by restarting CF.
This is a RedHat AS 4 Linux machine and it happens with both CFMX7 and CF8 in single server format. I've watched the memory charts with CF8 (very cool) and you can see the peaks and valleys for the Oracle run but the SQL Server app grows and grows.
I have turned on Heap logging and watched several Young GC iterations followed by a Full GC. That pattern continues while the Oracle app is running. However the SQL Server app starts like that but as time goes on it resorts to only Full GCs until it gets to the "GC time is exceeding GCTimeLimit of 98%" errors and "java.lang.OutOfMemoryError: Java heap space" errors.
So my questions are: given that the apps run differently on the same machine, could there be a difference between the Oracle and SQL Server data sources and why doesn't CF ever find the application is gone and give back some heap space?