garbage-collection

How does the Garbage Collector update the references pushed to the operand stack?

余生长醉 提交于 2021-02-08 03:35:28
问题 The JVM can easily update the references of local variables, static references, class instances or object array instances when moving an object in heap. But how can it update the references pushed to the operand stack? 回答1: There is no fundamental difference between a local variable and an entry in the operand stack. Both live in the same stack frame. Neither is formally declared and both need the JVM to perform inference to recognize their actual use. The following code public static void

Ruby forcing garbage collection not working as expected

空扰寡人 提交于 2021-02-08 01:42:09
问题 In the following code: class ExampleClass def initialize ObjectSpace.define_finalizer(self, proc{puts 'dead'}) end end ex = ExampleClass.new ex = nil GC.start while true # the while loop is to prevent the program from terminate # if the program does terminate, the finalizer gets called in the end like expected end The finalizer here is never called and there is no output. I would have expected the garbage collector to collect ex since it has been dereferenced. Why is GC.start not forcing ex

Does the StackMapTable affect the garbage collection behavior?

浪尽此生 提交于 2021-02-07 20:18:53
问题 I have code like this: public class TestGC { private static final int _10MB = 10 * 1024 * 1024; // 10MB public static void main(String[] args) { test1(); // test2(); } public static void test1() { int i = 1; if (i > 0) { byte[] data = new byte[_10MB]; } System.gc(); } public static void test2() { if (true) { byte[] data = new byte[_10MB]; } System.gc(); } } I run it with jvm option -verbose:gc , My java env: java version "1.7.0_79" Java(TM) SE Runtime Environment (build 1.7.0_79-b15) Java

Big O analysis of garbage collection runtime cost

老子叫甜甜 提交于 2021-02-07 19:52:12
问题 When reasoning about runtime cost in a garbage collected language, what is the cost of a statement such as myList = null; in terms of 'n' (the number of elements in the list)? For sake of argument, consider the list to be a singly linked list of reference types with no finalisation required. More generally, I'm looking for any information on how runtime cost can be analysed in a language with GC. 回答1: My own thought is that the cost is likely to be either O(1) or O(n) depending on the

How to correctly dereference then delete a JavaScript Object?

人走茶凉 提交于 2021-02-07 12:01:46
问题 I would like to know the correct way to completely dereference a JavaScript Object from memory. To ensure it's deletion without it dangling in memory, and that the garbage collector removes the object. When I looked and this question Deleting Objects in JavaScript. It was explained that if you delete all the references of object, the GC will remove it from memory. I want to know how do I go about removing references from an object that has both methods and properties. Suppose you have and

Is it possible to generate ansi C functions with type information for a moving GC implementation?

半腔热情 提交于 2021-02-07 10:35:28
问题 I am wondering what methods there are to add typing information to generated C methods. I'm transpiling a higher-level programming language to C and I'd like to add a moving garbage collector. However to do that I need the method variables to have typing information, otherwise I could modify a primitive value that looks like a pointer. An obvious approach would be to encapsulate all (primitive and non-primitive) variables in a struct that has an extra (enum) variable for typing information,

Running out of memory looping through mail items

て烟熏妆下的殇ゞ 提交于 2021-02-07 08:51:41
问题 Hi I have a Outlook com addin that is doing some simple searching tricks for me. I am part way through putting it together but I am having issues with it running out of memory. The process is very simple and basically loops through an outlook folder checking each mailItem for a match. given the loop reinitialize the variables each time I would have expected the garbage collector to keep up but when I watch the memory it loses ~10m/sec until the system is out of memory and I get unhandled

Running out of memory looping through mail items

蓝咒 提交于 2021-02-07 08:48:02
问题 Hi I have a Outlook com addin that is doing some simple searching tricks for me. I am part way through putting it together but I am having issues with it running out of memory. The process is very simple and basically loops through an outlook folder checking each mailItem for a match. given the loop reinitialize the variables each time I would have expected the garbage collector to keep up but when I watch the memory it loses ~10m/sec until the system is out of memory and I get unhandled

Running out of memory looping through mail items

旧巷老猫 提交于 2021-02-07 08:47:33
问题 Hi I have a Outlook com addin that is doing some simple searching tricks for me. I am part way through putting it together but I am having issues with it running out of memory. The process is very simple and basically loops through an outlook folder checking each mailItem for a match. given the loop reinitialize the variables each time I would have expected the garbage collector to keep up but when I watch the memory it loses ~10m/sec until the system is out of memory and I get unhandled

Garbage collector in Ruby on Rails?

元气小坏坏 提交于 2021-02-07 07:10:21
问题 I have tried to Google a lot about Rails Garbage collector, but I didn't get a reliable answer. Has anyone got a source to show how garbage collection is implemented in Rails? How can we control it? 回答1: Rails is a framework, not a language. The language behind Rails is called Ruby. This means there is no notion of Garbage Collector in Rails. You should search for documentation about the Ruby Garbage Collector. You can start from the Ruby GC module. The GC module provides an interface to Ruby