garbage-collection

.Net vs Java Garbage Collector

六月ゝ 毕业季﹏ 提交于 2020-01-27 03:22:17
问题 Does anyone know the major differences between the Java and .Net garbage collectors? A web search has not revealed much, and it was a question that came up in a test. 回答1: The difference is between the CLR (.Net) GC and the JVM GC rather than the languages themselves. Both are subject to change and the specification of their behaviour loose to allow this to be changed without it affecting the correctness of programs. There are some historical differences largely due to .Net being designed

Tkinter crashing on garbage collected variable: _tkinter.TclError: can't set “PY_VAR1”:

六月ゝ 毕业季﹏ 提交于 2020-01-26 04:45:49
问题 I'm attempting to write a widget using Tkinter. The script uses an .ini file to store some saved settings. The interface allows the user to enter a new name to a dropdown menu, and save some text strings associated with it. A stripped down version is linked below. I'm using String variables to track the changes to input fields. The issue I'm seeing is that occasionally, when a user goes to add another custom entry, the script will crash when attempting to update the text field with some

memory leak with spring ConfigurableApplicationContext

ぐ巨炮叔叔 提交于 2020-01-26 02:08:05
问题 public class Tasker{ ConfigurableApplicationContext context ; public void load(){ context = = loadSpringContext(); } pulic void doSomething(){ //do something } public void close(){ context.close(); } } public class Caller extends Thread { public void run(){ Tasker tasker = new Tasker(); try{ tasker.load(); tasker.doSomething(); }finally(){ tasket.close(); } } } //sample driver code which is not in my control Caller caller = new Caller() caller.start(); caller.stop(); Now the problem is if

Is it possible to trace references between objects in Flash, in the same way as the Flash Builder profiler?

こ雲淡風輕ζ 提交于 2020-01-25 18:44:47
问题 I'm trying to find memory leaks in a fairly large Flex application and I'm tired of using the paltry tools Flash Builder makes available. Specifically, I want to analyse the relationships of objects in memory, using the same information Flash Builder's tools appear to have access to. I.e. which objects are in memory, and which objects they have references to, and have references to them. Given that information, I want to construct a directed graph whose nodes are live objects and whose edges

Global object (based on “extend Application”) evaporates overnight.. why?

断了今生、忘了曾经 提交于 2020-01-25 08:17:26
问题 I have an android app where I extend the application object as such public class Globals extends Application { private Map<String, Object> Creators = new LinkedHashMap<>(); } Globals has various things in it. usually HashMaps of things - I use it as a global json cache where each Context has an instance of this. Now overnight it appears the Application object can sometimes be empty. i.e. I use the app go away and go to sleep, go back to testing it in the morning and all the json caches are

Global object (based on “extend Application”) evaporates overnight.. why?

独自空忆成欢 提交于 2020-01-25 08:16:26
问题 I have an android app where I extend the application object as such public class Globals extends Application { private Map<String, Object> Creators = new LinkedHashMap<>(); } Globals has various things in it. usually HashMaps of things - I use it as a global json cache where each Context has an instance of this. Now overnight it appears the Application object can sometimes be empty. i.e. I use the app go away and go to sleep, go back to testing it in the morning and all the json caches are

Garbage Collection not running for Code Cache Memory Pool

China☆狼群 提交于 2020-01-25 02:51:07
问题 When I am printing the details of garbage collection using GarbageCollectorMXBean the output shows me the following information:- Name: PS ScavengeCollection count: 72 Collection time: 3041 Memory Pools: PS Eden Space PS Survivor Space Name: PS MarkSweepCollection count: 5 Collection time: 4922 Memory Pools: PS Eden Space PS Survivor Space PS Old Gen Now quite rightly the ScavengeCollection and MarkSweep collection covers 4 of the 5 available memory pool excluding Code Cache (Non Heap Memory)

How to use byte array as key in RDD?

十年热恋 提交于 2020-01-24 20:14:47
问题 I want to use Array[Byte] as Key from RDD. For example: val rdd1:RDD[((Array[Byte]), (String, Int)] = from src rdd val rdd2:RDD[((Array[Byte]), (String, Int)] = from dest rdd val resultRdd = rdd1.join(rdd2) I want to perform join operation on rdd1 and rdd2 using Array[Byte] as Key but always getting resultRdd.count() = 0. So I tried to serialize the Array[Byte] and It is working fine as I want to see, only for small Dataset. val serRdd1= rdd1.map { case (k,v) => (new SerByteArr(k), v) } val

How to subscribe to an event without preventing garbage collection?

六眼飞鱼酱① 提交于 2020-01-24 18:40:49
问题 Let's say AppConfiguration.Instance is a singleton. Now let's say my UI dynamically adds a button that should change it's text if the configuration is change, so my app could do: AppConfiguration.Instance.Changed += Changed_Handler; On the button's code, but I don't wanna do that because that will prevent garbage collecion of the button after the user navigates to another screen and the button gets removed from the form My question is: Is there a design pattern for listening to an event

Why does FxCop flag GC.KeepAlive() as a violation?

馋奶兔 提交于 2020-01-24 16:56:06
问题 what is so bad about GC.KeepAlive() that FxCop flags this as a violation? 回答1: Probably because it's considered bad practice to be calling it, just like it's a generally a bad idea to call GC.Collect -- it has generally negative consequences on the collector and/or is a possible indication of a design flaw on your end. You should be able to reconfigured FxCop to not consider calls to the method a problem if you need to call it, however. There are valid reasons to do so, after all. 回答2: It's