There's a WCF self hosted service that must work 99% of time. Sometimes we got some memory troubles like this:
But service is working as usual after that issues. How can we manage this? Any tips and points to make robust services that will survive in different except situations are very very welcome.
When the heap becomes full, garbage is collected. During the garbage collection objects that are no longer used are cleared, thus making space for new objects.
Java Heap space is one of the most common errors when it comes to memory handling in the Java Virtual Machine world. This error means that you tried to keep too much data on the heap of the JVM process and there is not enough memory to create new objects, and that the garbage collector can't collect enough garbage.
The heap is cleared by the garbage collector whenever it feels like it. You can ask it to run (with System. gc() ) but it is not guaranteed to run.
In a word, yes, it can. While the heap can grow and shrink, it does have lower and upper bounds (usually defined by the -Xms and -Xmx arguments, unless you choose to se the defaults). If the heap size is exceeded, the allocation will fail and you'll get a java.
I am not too sure where the problem resides but memory leaking can be a reason.
All code is managed. And we use dotConnect for Oracle from devArt as data layer library.
You assume all code is managed, but there can be unmanaged parts. However, you must call the Dispose method for all the disposable objects after using them, don't think they are properly dispose once they go out of scope. The best practice is, not to let Disposable objects to go out of scope without calling their Dispose method. You may be able to use 'using' statements if you are using them as local variables.
DbConnection is a good example for disposable objects, make sure you dispose all the connections (disposable objects).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With