garbage-collection

How is memory allocated when you create a property of class?

我的梦境 提交于 2019-12-24 09:48:06
问题 I have the following class: public class A { public List<string> AList { get; set; } } Then I create object of a class: A objectA = new A(); objectA.AList = new List<string>() { "1", "2", "3" }; My question is how memory will be allocated in a heap? I mean will be objectA.AList allocated inside of objectA (image1) or as a separate object in a heap(image2) Image1: Image2: 回答1: The correct answer is : Image 3. I'm not going to draw this but your example leads to 5 objects on the Heap. Objects

what is the reason for high % time in GC? for our app pool in APM perfmonitor tool, we see it crossing 99% and staying their for hours [closed]

五迷三道 提交于 2019-12-24 09:09:53
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed last year . Does this mean memory leakage? The %Time in GC goes to 99% even when noone is using the application. Could you please help me why this %time in GC counter is strangely behaving. this could be a code issue? application is in Asp.net and uses services to call some methods. For disposing oracle

Java Garbage Collection and big objects

随声附和 提交于 2019-12-24 08:55:54
问题 I have rasters in my program of approximately 1500x500 pixels. Each pixel is represented with a float. I believe that means that 1500x500x4(bytes) = 3 million bytes or 3mb. They can be bigger than this. Does the Java Garbage Collector treat big objects differently than smaller ones? Do they skip into a higher generation automatically? 回答1: Larger objects can be placed straight into tenured space. The size of the individual objects is what matters e.g. float[1500][1500] is 1500 objects which

What exactly takes place behind the scenes when you call System.gc()?

寵の児 提交于 2019-12-24 08:28:22
问题 Calling System.gc() requests that garbage collection takes place, and isn't guaranteed. The part about it not being guaranteed is interesting to me: can someone explain the exact process that takes place when you make this call? 回答1: There are no guarantees that a garbage collection will take place, because there are no guarantees that the JVM supports garbage collection (I don't believe it's mentioned in the JLS at all, certainly not in the index). However, I think this belief that "it's not

CLR Garbage Collector frequency and system memory available

回眸只為那壹抹淺笑 提交于 2019-12-24 08:14:20
问题 I have a system with 300MB of physical memory available and 6 .NET processes. Each of them can jump from 100MB in idle to 500MB in stress when resources are available. I know that system specs have to be increased but I wonder whether GC will try to collect memory more often and try to keep processes memory allocation as small as possible? Does\how GC frequency depend on system memory available? I'm using 2.0 runtime. 回答1: Garbage collection indeed depends on the system memory. It's lazy.

AS3: Weak Listener References Not Appropriate During Initialization?

不想你离开。 提交于 2019-12-24 08:13:08
问题 as i currently understand, if an event listener is added to an object with useWeakReference set to true, then it is eligible for garbage collection and will be removed if and when the garbage collection does a sweep. public function myCustomSpriteClass() //constructor { this.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownListener, false, 0, true); this.addEventListener(MouseEvent.MOUSE_UP, mouseUpListener, false, 0, true); } in this case, is it not appropriate to initialize an object with

can i register the widget from java code instead of android manifest?

北慕城南 提交于 2019-12-24 07:29:07
问题 So here is the thing,i have an app,if the music is not playing(for which i am using service) and the user exits out of the activity then I want the service to stop and the app to stop too,which happens perfectly Now i start the app again,everything works fine,except the widget stops receiving the broadcasts even though that same broadcasts is being received by another activity when it is supposed to. Also strangely the widget is able to send broadcasts (it is only unable to receive it) so it

How to set the instance to null inside class?

房东的猫 提交于 2019-12-24 07:28:10
问题 I want to create a release() method in my class. After calling release() , how can I set that instance to null ? I mean this: ABC abc = new ABC(); abc.release(); if(abc == null) Log.d("That's what I want"); then I want to check if abc is null . How do I do this? 回答1: You don't have to do this from inside the instance per sé. If you remove the reference ( all references) to this object then it will be automatically removed the next time the garbage collector does his rounds. Simply do ABC abc

What's the Mark-Compact algorithm used by HotSpot?

对着背影说爱祢 提交于 2019-12-24 07:26:06
问题 When reading the Mark-Compact chapter on The Garbage Collection Handbook, a sequence of alternatives were presented, but most of them looked old / theoretical (for instance, the 2-finger compaction and the Lisp2 3-pass approach requiring an extra header word per object). Is anyone aware of what algorithm does HotSpot uses when running Mark-Compact (in its old-generation, I assume)? Thanks 回答1: Big disclaimer: I am not a GC expert/writer; all the things that are written bellow are subject to

.Net: Is it possible to get object instances created earlier by class type?

℡╲_俬逩灬. 提交于 2019-12-24 07:09:54
问题 Is it possible in .net to get all instances of concrete type created in application? I guess such information is stored in GC, but is it accessible from code? 回答1: Check Raymond Chen's blog about why that's a bad idea(except for debugging). http://blogs.msdn.com/b/oldnewthing/archive/2010/08/12/10049155.aspx And to implement it you'd need to walk all objects on the heap since it's unlikely that the CLR keeps track of the object by type, so it would be very slow. 回答2: No, it's not available