garbage-collection

Tomcat crashes with error java.lang.OutOfMemoryError: GC overhead limit exceeded

心已入冬 提交于 2020-01-02 04:39:06
问题 After the tomcat ran several months, I got unexpectetly the error below. We restarted the tomcat and the error do not appear now but may be will come again in the future. I saw that another users had simmilar exceptions, related with the garbage collection, but not related exactly with the NIO connector. Does somebody has an idea why this happens and what should be the correct fix to avoid it. Jan 15, 2016 7:46:47 AM org.apache.tomcat.util.net.NioEndpoint$SocketProcessor run SEVERE: java.lang

How to properly implement a finalizer for detecting resource leaks in Java

此生再无相见时 提交于 2020-01-02 04:35:11
问题 Let's say I have created some resource class with a close() method for cleaning up the resource, and I want to override finalize() to free the resource (and print a warning) if someone has forgotten to call close(). How can this be done properly? Is it recommended only for native (JNI-allocated) resources? What happens if you use a reference to another object that has been finalized, from a finalizer? If there are cyclic dependencies I don't see how the garbage collector can prevent you from

Tuning Garbage Collection parameters in Java

偶尔善良 提交于 2020-01-02 04:08:08
问题 I have a server java component which has a huge memory demand at startup which mellows down gradually. So as an example at startup the memory requirement might shoot unto 4g; which after the initial surge is over will go down to 2g. I have configured the component to start with memory of 5g and the component starts well; the used memory surges upto 4g and then comes down close to 2g. The memory consumed by the heap at this point still hovers around 4g and I want to bring this down

On scala project - Getting error GC overhead limit exceeded when running sbt test command

僤鯓⒐⒋嵵緔 提交于 2020-01-02 02:33:51
问题 I'm new in scala programming and getting GC overhead limit exceeded error when I execute sbt test command in one of big scala project. Anyone knows how can I solve this? 回答1: I got help from my friends :) Increase the memory option by executing with -mem option for example: sbt -mem 2048 test Other options: For Mac & Linux user: if we need to execute this a lot. We can update the .bash_profile file and add below command: export SBT_OPTS="-Xmx2G" Other solution (works with Windows as well):

Why doesn't an unassigned Vue instance get garbage collected?

本小妞迷上赌 提交于 2020-01-02 02:32:05
问题 Here's the standard way to use VueJS on the HTML page (without bundles). No assignment. <script> new Vue({ el: '#root', data: { title: 'Hello' } }); </script> Why Garbage Collector doesn't collect this Vue object? 回答1: When you instantiate a Vue object, it actually mounts itself to the DOM element, here #root element, as briefly hinted in this documentation page The Vue Instance > Instance Lifecycle Hooks. By using Developer Tools in your browser, like in Chrome, you can open the console tab

Why do we need Dispose() method on some object? Why doesn't the garbage collector do this work?

徘徊边缘 提交于 2020-01-02 01:07:06
问题 The question is: why do we need to call Dispose() on some objects? Why doesn't the garbage collector collect the object when it goes out of scope? I am trying to understand the reason why it was implemented like that. I mean, wouldn't it be easier if Dispose() was called when the garbage collector collected out of scope objects. 回答1: The garbage collector is non-deterministic - it collects objects at some point after they're no longer referenced, but it's not guaranteed to happen in a timely

Why do we need Dispose() method on some object? Why doesn't the garbage collector do this work?

荒凉一梦 提交于 2020-01-02 01:06:11
问题 The question is: why do we need to call Dispose() on some objects? Why doesn't the garbage collector collect the object when it goes out of scope? I am trying to understand the reason why it was implemented like that. I mean, wouldn't it be easier if Dispose() was called when the garbage collector collected out of scope objects. 回答1: The garbage collector is non-deterministic - it collects objects at some point after they're no longer referenced, but it's not guaranteed to happen in a timely

Memory leak, spring 3.2.0.RELEASE, httpcomponents 4.2.3

跟風遠走 提交于 2020-01-01 19:29:12
问题 Using spring 3.2.0.RELEASE resttemplate & httpcomponents 4.2.3 to make rest calls. Memory footprint is steadily increasing until it reaches max. Following is the configuration: <bean id="myRestTemplate" class="org.springframework.web.client.RestTemplate"> <constructor-arg> <bean class="org.springframework.http.client.HttpComponentsClientHttpRequestFactory"> <constructor-arg index="0"> <bean factory-bean="httpClient" factory-method="get"/> </constructor-arg> </bean> </constructor-arg> </bean>

JVM sawtooth idle process

萝らか妹 提交于 2020-01-01 18:57:59
问题 I'm currently doing a research invovling a bit of the JVM and how it's memory usage works. What I don't understand is, what does the JVM fill it's memory with when idle, just to release it all when the heap is almost reached? Why isn't there just one flat line of used memory? btw, this java application is hosted on glassfish, but I have the same graphs when I just have an easy 'hello world' swing application. So GlassFish doesn't have to do anything with it. Thanks in advance! 回答1: what does

.NET Garbage Collection behavior (with DataTable obj)

流过昼夜 提交于 2020-01-01 15:10:36
问题 I am wondering why after creating a very simple DataTable and then setting it to null does the Garbage Collection not clear out all the memory used by that DataTable. Here is an example. The variable Before should be equal to Removed but it is not. { long Before = 0, After = 0, Removed = 0, Collected = 0; Before = GC.GetTotalMemory(true); DataTable dt = GetSomeDataTableFromSql(); After = GC.GetTotalMemory(true); dt = null; Removed = GC.GetTotalMemory(true); GC.Collect(); Collected = GC