garbage-collection

V8 garbage collector callbacks for measuring GC activity

为君一笑 提交于 2020-03-24 03:08:50
问题 I have a small question related to V8 6.7.240 GC behavior and AddGCPrologueCallback / AddGCEpilogueCallback callbacks. A little story behind the problem: we launch custom JS code using V8 engine, and in order to limit execution by time we have a watchdog (separate thread with isolate->TerminateExecution() call) that monitors code and kills it in case of long running, but with respect to GC activity. So, if code execution timeout equals to 200ms , GC activity takes 300ms and code takes 199ms

V8 garbage collector callbacks for measuring GC activity

百般思念 提交于 2020-03-24 03:07:46
问题 I have a small question related to V8 6.7.240 GC behavior and AddGCPrologueCallback / AddGCEpilogueCallback callbacks. A little story behind the problem: we launch custom JS code using V8 engine, and in order to limit execution by time we have a watchdog (separate thread with isolate->TerminateExecution() call) that monitors code and kills it in case of long running, but with respect to GC activity. So, if code execution timeout equals to 200ms , GC activity takes 300ms and code takes 199ms

How finalizable objects takes at least 2 garbage collection cycles before it can be reclaimed?

大城市里の小女人 提交于 2020-03-23 07:24:10
问题 I'm reading this article and I can't really understand how the finalizable objects (objects which override the finalize method) takes at least 2 GC cycles before it can be reclaimed . It takes at least two garbage collection cycles (in the best case) before a finalizeable object can be reclaimed. Can someone also explain in detail how is it possible for a finalizable object to take more than one GC cycle for reclamation? My logical argument is that when we override finalize method, the

Will `jcmd PID GC.class_histogram` call a full GC before collecting data?

六月ゝ 毕业季﹏ 提交于 2020-03-19 07:46:50
问题 When I run jcmd PID help GC.heap_dump , the help clearly says that full GC will be called, unless -all flag is specified: GC.heap_dump ... Impact: High: Depends on Java heap size and content. Request a full GC unless the '-all' option is specified. <...> -all : [optional] Inspect all objects, including unreachable objects (BOOLEAN, false) If I run jcmd PID help GC.class_histogram , the help doesn't say anything about forcing a full GC, however "Impact" is still said to be "high", and the

jstat : Survivor and Eden Space capacity decrease over a period

和自甴很熟 提交于 2020-03-02 19:13:09
问题 Does anytime java(8) memory capacity decrease until JVM restart? I am using jstat -gc to dump memory information and here is the snapshot from two days. The second snapshot has less captaity for SC1 and EC compared to the first snapshot. Can someone help/explain why I am seeing this behavior? is that expected? Java version : java-1.8.0-openjdk-1.8.0.191.b12 sc1: survivor space 1 capacity EC: eden space capacity S0C, S1C, S0U, S1U,EC,EU,OC,OU,MC,MU,CCSC,CCSU,YGC,YGCT,FGC,FGCT,GCT 4096.0,7168.0

How is return by reference implemented in C#?

给你一囗甜甜゛ 提交于 2020-03-02 09:14:17
问题 Given that C# GC can move memory around, how could ref-return even be implemented? Would the code below cause 'undefined behaviour'? public struct Record { public int Hash; public VeryLargeStruct Data; } public class SomeClass { private Record[] _records = new Record[16]; public ref VeryLargeStruct GetDataAt(int index) => ref _records[index].Data; } I would assume that if memory associated with _records reference moved that it would invalidate local references such as: ref var data = ref

What are the practical examples of reference cycles?

此生再无相见时 提交于 2020-02-27 06:25:14
问题 Garbage collectors have functionality to deal with reference cycles. As far, as I understand, this is necessary for all languages with GC. But I do not understand, why there can not be created language avoiding reference cycles, using some weak references, if necessary. What are the real life examples of unavoidable reference cycles, arising in programming? 回答1: You can not create a programming language avoiding reference cycles, as it would be the responsibility of the application programmer

What are the practical examples of reference cycles?

╄→гoц情女王★ 提交于 2020-02-27 06:25:13
问题 Garbage collectors have functionality to deal with reference cycles. As far, as I understand, this is necessary for all languages with GC. But I do not understand, why there can not be created language avoiding reference cycles, using some weak references, if necessary. What are the real life examples of unavoidable reference cycles, arising in programming? 回答1: You can not create a programming language avoiding reference cycles, as it would be the responsibility of the application programmer

My program crashes when GC perform garbage collection

混江龙づ霸主 提交于 2020-02-25 09:54:11
问题 My program has a trouble: When GC perform garbage collection,my program always crashes at a function,which is called by main flow several times before crashing and the first line of this function is GC.Collect().The function main action is sending some bytes to serial port and receiving some bytes from the same serial port( Both sending and received bytes are below 256 bytes) each time.GC.Collect() calling is for locating the crashing point,it'll be removed in release edition. I don't know

Is it true that - Garbage Collector won't collection the object of struct type

本小妞迷上赌 提交于 2020-02-25 07:29:24
问题 Yesterday, we had a discussion on Gargbage collection. It was discussed that the objects created using Classes are collected by Garbage collector, but it cannot be collected by GC if it is being created using struct I know that structures uses stack and classes uses heap. But, I guess GC never collects unmanaged codes only. So does that mean that the Structure types are unmanaged code. (I don't think so). OR is it that the GC take care of Heap only and not Stack? If yes, then what about int