I wrote a little Linq like DSL on top of Google Collections
public class IterableQuery {
public static <T> Where<T> from(Iterable<T> originalCollection) {
return new Where<T>( Iterables.transform(originalCollection, IterableQuery.<T>SAME()));
}
private static <T> Function<T, T> SAME() {
return new Function<T...
For example I’ve got a third-party class with unsafe code in it’s methods. It makes some memory changes and doesn’t clear memory after itself. It happens, that i have to use this class and it’s unsafe methods.
Can you, please, explain me, what will happen to those bytes written by unsafe code, after next Garbage Collector pass.
...
Does adding -Xmx argument when running a Java program cause the garbage collector to act differently or occur less often?
...
GC.Collect appears to start the garbage collection in a background thread, and then return immediately. How can I run GC.Collect synchronously -- i.e., wait for the garbage collection to complete?
This is in the context of NUnit tests. I tried adding the gcConcurrent setting to my test assembly's app.config file, and I tried the same wi...
Basically, I have an object that I think should be garbage-collected but it's not.
I am pretty certain all references to it are gone from what I can see in the code but for some reason, it is not getting destroyed.
Is there some way to find out what's holding my object hostage?
There doesn't seem to be a way to do that in Visual Studio ...
Hi.
how could I request Java garbage collection externally, starting the program from JAR (Windows BAT used)?
From the Java code I can do it with System.gc()
When running a JNLP distribution, I get this "Java console" turned on from Control Panel / Java / ... and this Java console provides manual garbage collection.
But... When I'm...
I'm aware that the best practice is to call Dispose on any object that implements IDisposable, especially objects that wrap finite resources like file handles, sockets, GDI handles, etc.
But I'm running into a case where I have an object that has a Font, and I would have to plumb IDisposable through several layers of objects, and review...
I hope I framed the question right. I am trying to force myself to be a better programmer. By better I mean efficient. I want to write a program to identify the files in a directory and read each file for further processing. After some shuffling I got to this:
for file in os.listdir(dir):
y=open(dir+'\\'+file,'r').readlines()
...
I am running the code below and the result is totally different when it runs in Release mode. While in Debug mode, it never collects the object of class A and in Reaelse mode it immediately collects the object of class A.
Can someone explain why.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
...
I recently read the excellent article "The Transactional Memory / Garbage Collection Analogy" by Dan Grossman. One sentence really caught my attention:
In theory, garbage collection can
improve performance by increasing
spatial locality (due to
object-relocation), but in practice we
pay a moderate performance cost for
softw...
I have this class and I'm testing insertions with different data distributions. I'm doing this in my code:
...
AVLTree tree = new AVLTree();
//insert the data from the first distribution
//get results
...
tree = new AVLTree();
//inser the data from the next distribution
//get results
...
I'm doing this for 3 distributions. Eac...
When I typed:
>>> astrd = 123
>>> import sys
>>> sys.getrefcount(astrd)
3
>>>
I am not getting where is astrd used 3 times ?
...
A lot of JVM's command line arguments dealing with the garbage collector have "CMS" prepended to them. What does this stand for?
...
Hi all,
Quick question about the theory of GCing. I have the following method. It runs, and exits the method. How come even after GC is run, the timer still exists and keeps "TICK"ing? I don't believe there's still a reference to timer or the timertask anymore after this method exists, so I'd expect the timer to be GCed and cause an...
I have a Java web app running on JBoss behind Apache (via mod_jk) and I'm seeing some really odd GC behavior. I've attached a graph of it to this question. Has anyone seen similar GC behavior before? It's Java 6 running with default GC tuning from ergonomics on a server-class machine. Thanks.
NOTE: The above image is a link to the ful...
In a lay-man terminology how to define garbage collection mechanism. How an object is identified to be available for garbage collection?
In lay-man terms define GC algorithms i.e. Reference Counting, Mark and Sweep, Copying, Train etc?
...
shared_ptr is a reference counting smart pointer in the Boost library.
The problem with reference counting is that it cannot dispose of cycles. I am wondering how one would go about solving this in C++.
Please no suggestions like: "don't make cycles", or "use a weak_ptr".
Edit
I don't like suggestions that say to just use a weak_ptr...
I've got a popup window that gives data back to its parent. Using window.opener.document.data = data_from_popup;
This work well in FF, but in IE (6/7) the data can be accessed for the time the popup is still displayed. When I close the popup it looks like the data gets garbage collected.
I've tried to use a clone() function for the dat...
This simple sample code demonstrates the problem. I create an ArrayBlockingQueue, and a thread that waits for data on this queue using take(). After the loop is over, in theory both the queue and the thread can be garbage collected, but in practice I soon get an OutOfMemoryError. What is preventing this to be GC'd, and how can this be fi...
I'm debugging a memory leak with windbg/sos and I cannot find a way to have sos force a garbage collection. The list of sos commands does not seem to include gc.
...