garbage-collection

Are spinlocks a good choice for a memory allocator?

I've suggested to the maintainers of the D programming language runtime a few times that the memory allocator/garbage collector should use spinlocks instead of regular OS critical sections. This hasn't really caught on. Here are the reasons I think spinlocks would be better: At least in synthetic benchmarks that I did, it's several t...

Garbage Collection when Attached dependencyobject is destroyed \ disconnected

Hi Guys, When we use any attached property against any dependency object, I thunk it actually maps the property and the value with the dependency object. E.g. <DockPanel><TextBlock x:Name="MyText" DockPanel.Dock="Top"/></DockPanel> Here value "Top" is mapped with DockPanels DockProperty via the dependency object textblock "MyText" ...

What does Python's GIL have to do with the garbage collector?

I just saw this section of Unladen Swallow's documentation come up on Hacker News. Basically, it's the Google engineers saying that they're not optimistic about removing the GIL. However, it seems as though there is discussion about the garbage collector interspersed with this talk about the GIL. Could someone explain the relation to ...

Lost references in Lua

Having a problem with objects, not needed any more but still having references. Result: size of allocated memory is constantly growing due to not collected objects. How to solve this sort of problem? Is there any way to find objects with only one reference, or objects with lifetime more than some value? Or any another solution? Using L...

Programatically invoke garbage collector

Is there a way to invoke the garbage collector on a specific object within managed memory from an application? e.g. (in pseudo-code) Read myString from file; perform arbitrary operation on myString; invoke garbage-collector to remove myString ...

Problem with luabind::object dereferencing (simplified)

Using C++, lua5.1, luabind 0.7 Lua code: -- allocates near 8Mb of memory function fff() local t = {} for i = 1, 300000 do table.insert(t, i) end return t end C++ code: { luaL_dostring(lua_state, "return fff()"); luabind::object obj(luabind::from_stack(ls, -1)); } lua_gc(l_, LUA_GCCOLLECT, 0); // colle...

What does "garbage collection rate" mean, and what benefit it could provide?

In analyzing Java GC behavior, some tools has the metric "garbage collection rate" (an example would be in figure 19. from http://www.ibm.com/developerworks/java/library/j-ibmtools2/#fig19) of which the unit is MB/sec. It's a rarely metric compared to others, like GC utilization. It looks like representing how fast GC cleans up. But doe...

Storing a lua class with parent in luabind::object (updated)

Using C++, lua 5.1, luabind 0.7-0.81 Trying to create a lua class with parent and store it in a luabind::object. Lua class 'TestClassParent' function TestClassParent:__init() print('parent init\n') end function TestClassParent:__finalize() print('parent finalize\n') end class 'TestClass' (TestClassParent) function TestCla...

Java references

Is there any way to find all references to an object (in Java)? I have a cache of objects, and would like to periodically scan it to see if removing the object will cause it to be destroyed. ...

Luabind class deriving problem (memory 'leak')

Using luabind 0.81 Simple test to illustrate the problem: 1) class 'A' function A:__init() print('A init\n') end function A:__finalize() print('A finalize\n') end do local obj = A() end collectgarbage("collect") Output: A init A finalize 2) class 'A' function A:__init() print('A init\n') end function A:__finaliz...

When should I use delete vs setting elements to null in JavaScript ?

Possible Duplicate: Deleting Objects in JavaScript I have a JS object having a large number of properties. If I want to force the browser to garbage collect this object, do I need to set each of these properties as null or do I need to use the delete operator? What's the difference between the two? ...

Are all of the finalizers invoked during a garbage collection?

Let's say i'm trying to allocate 100 bytes, but since I don't have 100 bytes available in my GC heap, a garbage collection is triggered. Also, in my GC heap there's 100mb worth of unreachable objects. To my understanding, once the GC freed 100bytes, he could decide to stop the collection and continue the program's execution. So let's say...

How to deterministically release Core Foundation object in Garbage Collected environment?

I use Core Foundation methods in garbage-collected environment. According to documentation call to CFRelease simply decrements reference count but does not release the object: The difference between the garbage-collected environment and reference-counted environment is in the timing of the object’s deallocation. In a reference counte...

C#: What is destroying my NativeWindow object and why?

I am using a NativeWindow object to subclass an unmanaged window's message pump, with the purpose of intercepting its messages. Code structure looks something like this (its psuedo C#, please excuse minor syntax problems): class AppSubclass : Control { class SpecialAppWndProc : NativeWindow { protected override void WndProc(ref Me...

-Xms : Initial heap size or minimum heap size?

-Xms is to specify initial heap size or minimum heap size? I see lot of places with lot of different answers. Some like second answer here, say that it is for initial heap and some like here say that its minimum heap size. Or is it that the minimum size itself is the initial size? ...

GC collecting...what?

I am trying to optimize my engine (C# + SlimDX) to make as less allocations as possible (to prevent the GC from firing too often) using as guide a profiler that gives me where the garbaged object are generated. Its going pretty well (going down from like 20 MB garbaged every 5s to 8 MB garbaged every 1 minute and half (yep, it was very l...

Can one Ruby object destroy another?

In Ruby, can one object destroy another? For example: class Creature def initialize @energy = 1 end attr_accessor :energy end class Crocodile < Creature def eat(creature) @energy += creature.energy creature = nil #this does not work end end fish = Creature.new croc = Crocodile.new croc.eat(fish) After the cro...

Is shared ownership of objects a sign of bad design?

Hi all, Background: When reading Dr. Stroustrup's papers and FAQs, I notice some strong "opinions" and great advices from legendary CS scientist and programmer. One of them is about shared_ptr in C++0x. He starts explaining about shared_ptr and how it represents shared ownership of the pointed object. At the last line, he says and I quo...

Using CLR 4.0 Background GC on a Server

We're building a MMO server, highly optimized for latency. So, with the CLR 4.0 and with introduced new workstation GC, is it now possible to use Background Garbage collection on a Windows Server? ...

System.TimeSpan creating debugging problems? (Cannot evaluate expression because a thread is stopped at a point...)

Using System.TimeSpan in a C# application, with WPF. TimeSpan is an argument in a method call. SixDOFPosition GetPositionForTimeCount(TimeSpan timeCount) Using VS 2009, this error is displayed in the debugger when trying to look at the value of timeCount: Cannot evaluate expression because a thread is stopped at a point where ...