garbage-collection

What is a compaction in Java GC?

喜欢而已 提交于 2020-07-07 05:50:38
问题 I read http://www.cubrid.org/blog/tags/Garbage%20Collection/ article which gives high level picture of GC in Java. It says: The compaction task is to remove memory fragmentation by compacting memory in order to remove the empty space between allocated memory areas . Should objects be moved into anther places in order to fill holes? I think that objects are moved. If so that mean addresses are changed and so reference to that object also should be updated? It seems too complicated task to find

What is a compaction in Java GC?

爷,独闯天下 提交于 2020-07-07 05:49:42
问题 I read http://www.cubrid.org/blog/tags/Garbage%20Collection/ article which gives high level picture of GC in Java. It says: The compaction task is to remove memory fragmentation by compacting memory in order to remove the empty space between allocated memory areas . Should objects be moved into anther places in order to fill holes? I think that objects are moved. If so that mean addresses are changed and so reference to that object also should be updated? It seems too complicated task to find

Does JVM garbage collect objects being referenced by local variables which are no longer used? [duplicate]

本秂侑毒 提交于 2020-07-06 20:29:27
问题 This question already has answers here : Can java finalize an object when it is still in scope? (2 answers) Closed last year . As far as I know, a method's local variable is located in a stack frame in an executing thread and a reference type of a local variable only has a objects' reference, not the object itself. All of objects in JVM are located in a heap space. I want to know that objects referenced by local variables in a method being executed are never garbage collected until the end of

Does JVM garbage collect objects being referenced by local variables which are no longer used? [duplicate]

孤街醉人 提交于 2020-07-06 20:29:07
问题 This question already has answers here : Can java finalize an object when it is still in scope? (2 answers) Closed last year . As far as I know, a method's local variable is located in a stack frame in an executing thread and a reference type of a local variable only has a objects' reference, not the object itself. All of objects in JVM are located in a heap space. I want to know that objects referenced by local variables in a method being executed are never garbage collected until the end of

sed regex to non-greedy replace?

白昼怎懂夜的黑 提交于 2020-07-06 17:39:59
问题 I am aware of another question that is quite similar, but for some reason I'm still having problems. I have a GC log that I'm trying to trim out the Tenured section enclosed in [] . 63.544: [GC 63.544: [DefNew: 575K->63K(576K), 0.0017902 secs]63.546: [Tenured: 1416K->1065K(1536K), 0.0492621 secs] 1922K->1065K(2112K), 0.0513331 secs] I apply s/\[Tenured:.*\]// And quite expectantly, the result is trimmed greedily through the remainder of the line: 63.544: [GC 63.544: [DefNew: 575K->63K(576K),

sed regex to non-greedy replace?

╄→гoц情女王★ 提交于 2020-07-06 17:37:45
问题 I am aware of another question that is quite similar, but for some reason I'm still having problems. I have a GC log that I'm trying to trim out the Tenured section enclosed in [] . 63.544: [GC 63.544: [DefNew: 575K->63K(576K), 0.0017902 secs]63.546: [Tenured: 1416K->1065K(1536K), 0.0492621 secs] 1922K->1065K(2112K), 0.0513331 secs] I apply s/\[Tenured:.*\]// And quite expectantly, the result is trimmed greedily through the remainder of the line: 63.544: [GC 63.544: [DefNew: 575K->63K(576K),

Why doesn't G1 start a marking cycle when the InitiatingHeapOccupancyPercent is achieved?

陌路散爱 提交于 2020-07-04 11:29:11
问题 According to the documentation, XX:InitiatingHeapOccupancyPercent Sets the Java heap occupancy threshold that triggers a marking cycle. The default occupancy is 45 percent of the entire Java heap. In my current environment, that does not happen. My G1 garbage collection configuration is as follows -Xms25000m -Xmx25000m -XX:+UseG1GC -XX:MaxGCPauseMillis=1000 -XX:GCTimeRatio=99 -XX:InitiatingHeapOccupancyPercent=70 -XX:MaxTenuringThreshold=8 -XX:+UnlockExperimentalVMOptions -XX

Memory leak on pickle inside a for loop forcing a memory error

一曲冷凌霜 提交于 2020-07-04 03:15:25
问题 I have huge array objects that are pickled with the python pickler. I am trying to unpickle them and reading out the data in a for loop. Every time I am done reading and assesing, I delete all the references to those objects. After deletion, I even call gc.collect() along with time.sleep() to see if the heap memory reduces. The heap memory doesn't reduce pointing to the fact that, the data is still referenced somewhere within the pickle loading. After 15 datafiles(I got 250+ files to process,

How to make a long time Full GC in Java manually

萝らか妹 提交于 2020-07-03 05:00:29
问题 How to write some code to allocate the objects into Old Gen that will cause the full GC time longer than three or five seconds? 回答1: “Allocate the objects into Old Gen” and “long GC pauses” are hard to combine, as the worst thing you could do to the garbage collector, is to create lots of small, linked, live objects forming a graph that the garbage collector must traverse. But small objects are not allocated into the Old Gen. Only large objects, e.g. arrays, are allocated directly into the

Will an instance be garbage collected if a Task's callback get reference to the instance itself?

社会主义新天地 提交于 2020-06-29 04:08:30
问题 public class Cls { public object Obj { get; set; } public async void Func() { Task.Run(() => { Thread.Sleep(999999999); this.Obj = new { }; }); } } public class Program { public static void Main(string[] args) { new Cls().Func(); } } Please consider the above codes and neglect if it makes sense first. In the above case, I did not store instance of Cls into any variable, seems that nothing is referencing that instance and it would be GC. However, there is a Task.Run() in side Func . The