garbage-collection

If you stick to standard coding in .NET, is there reason to manually invoke the GC or run finalizers?

南楼画角 提交于 2019-12-23 12:59:25
问题 If you stick to managed code and standard coding (nothing that does unconventional things withe CLR) in .NET, is there any reason to manually invoke the GC or request to run finalizers on unreferenced objects? The reason I ask is thaty I have an app that grows huge in Working Memory set. I'm wondering if calling System.GC.Collect(); and System.GC.RunFinalizers(); would help, and if it would force anything that wouldn't be done by the CLR normally anyways. 回答1: No, it won't help. Don't do it.

coldFusion jvm Garbage Collection not

五迷三道 提交于 2019-12-23 12:56:15
问题 I have a cfc method that is looping through a list and making a series of SOAP calls via cfhttp. Then inserts the result into a database. The process itself works great the problem is that the java memory slowly fills up and eventually (depending on the number of elements in the records being returned) just stops working. There is no error or anything visible it just stops. If I look at the application log file via the coldfusion admin I see one or both of the following errors: GC overhead

coldFusion jvm Garbage Collection not

梦想的初衷 提交于 2019-12-23 12:54:59
问题 I have a cfc method that is looping through a list and making a series of SOAP calls via cfhttp. Then inserts the result into a database. The process itself works great the problem is that the java memory slowly fills up and eventually (depending on the number of elements in the records being returned) just stops working. There is no error or anything visible it just stops. If I look at the application log file via the coldfusion admin I see one or both of the following errors: GC overhead

What does “Perform GC” button do in jconsole?

↘锁芯ラ 提交于 2019-12-23 12:42:22
问题 There is a button "Perform GC" in jconsole, anyone knows what exactly happens if I click that button, it's invoking System.gc() ? 回答1: You can find out by yourself. The code of JConsole is part of OpenJDK. You can also check it out on grepcode.com. The button calls a gc() method of an object implementing MemoryMXBean which is most probably implemented by com.sun.management.MemoryImpl class. This class contains an implementation of gc() method which looks like this: public void gc() { Runtime

Do I need to implement a dispose or finalize in my objects?

天大地大妈咪最大 提交于 2019-12-23 12:10:05
问题 For too long I let the garbage collector do its magic, removing all responsibilities from my self. Sadly it never turned into an issue... So I never gave a second thought to the subject. Now when I think about it I don't really understand what the "dispose" function really does and how and when it should be implemented. The same question for finalize... And a last question... I have a class pictureManipulation : when I need to save/resize/change format ... I start a new instance of that class

Calling SuppressFinalize multiple times

别说谁变了你拦得住时间么 提交于 2019-12-23 10:40:13
问题 Is there any downside of calling GC.SuppressFinalize(object) multiple times? Protected Dispose(bool) method of the dispose pattern checks whether it is called before but there is no such check in the public Dispose() method. public void Dispose() { Dispose(true); GC.SuppressFinalize(this); } protected virtual void Dispose(bool disposing) { if (_Disposed) return; if (disposing) { // Cleanup managed resources. } // Cleanup unmanaged resources. _Disposed = true; } ~MyClass() { Dispose(false); }

Calling SuppressFinalize multiple times

情到浓时终转凉″ 提交于 2019-12-23 10:39:30
问题 Is there any downside of calling GC.SuppressFinalize(object) multiple times? Protected Dispose(bool) method of the dispose pattern checks whether it is called before but there is no such check in the public Dispose() method. public void Dispose() { Dispose(true); GC.SuppressFinalize(this); } protected virtual void Dispose(bool disposing) { if (_Disposed) return; if (disposing) { // Cleanup managed resources. } // Cleanup unmanaged resources. _Disposed = true; } ~MyClass() { Dispose(false); }

Android AsyncTask Starting Another AsyncTask

一世执手 提交于 2019-12-23 10:20:08
问题 I'm currently doing something like this in the AsyncTask's onPostExecute method, where NewTask is not the current task that's executing: private class OlderTask extends AsyncTask<String, Void, Integer> { //other functions (not important) @Override protected void onPostExecute(Integer result) { new NewTask().execute(null, null); } } I'm wondering if this is a bad idea. Will doing so cause GC for the OlderTask to wait for the NewTask? Are there any other possible problems with using such an

Objective-C: Do you have to dealloc property objects before deallocating the parent object?

[亡魂溺海] 提交于 2019-12-23 10:10:51
问题 Let's say I have an object named "foo" with another object named "bar" as property. When "foo" deallocates, will it automatically remove all references to "bar" so that "bar" deallocates as well? or will "foo" deallocate and "bar" float in memory somewhere? even if all of "bar"'s references are defined in "foo". thanks in advance. 回答1: If the foo object has any retains on or copies of (thanks Dave) bar , for example when you declare the property as either one of these: @property (nonatomic,

Issues with garbage collection and Picasso

丶灬走出姿态 提交于 2019-12-23 10:06:29
问题 I am trying to set an ImageView in a Google Maps Marker's InfoWindow and have copied the code from this answer pretty exactly, except that my InfoWindowAdapter isn't an anonymous inner class (it's just an inner class of the activity). This was working before, but for some reason it has stopped working - the onSuccess method in the Callback doesn't get called, so the InfoWindow only displays the image the second time it is opened. Looking at the logs for Picasso I'm getting messages similar to