garbage-collection

How can I improve garbage collector performance of .NET 4.0 in highly concurrent code?

I am using the task parallel library from .NET framework 4 (specifically Parallel.For and Parallel.ForEach) however I am getting extremely mediocre speed-ups when parallelizing some tasks which look like they should be easily parallelized on a dual-core machine. In profiling the system, it looks like there is a lot of thread synchroniz...

Do I need to close a SqlDataReader before I call Dispose on it?

According to this, Dispose() on a SqlConnection calls Close(), so you don't need to call both, just Dispose(). Is it the same for a SqlDataReader? ...

Why do I appear to have a memory leak when user "Server" garbage collection?

Here's my situation. I want an explanation of why this is happening. I am reading about GC here but I still don't get it. Workstation case: When I run with workstation garbage collection, my app ramps up to use about 180MB of private bytes and about 70MB in ".NET CLR Memory #bytes in all heaps". Memory continues to be stable for seve...

The method used in 3rd-party garbage collector

I am writing to clarify some comments on this website. 1) I know that C++ has no garbage collector. One said that C++ was invented before the idea of garbage collector, so that's the reason. Is that true? I think it makes sense. 2) Whenever garbage collector was discussed, smart point(such as boost::share_ptr) was brought out to be a ...

Where Is Machine.Config??

I want to change to use Server GC - I can do that by using the machine.config The only problem is I do not know where that is ...

What does .NET Memory "Gen X Heap Size" .NET performance counters measure exacly?

Is that "the sum of all objects allocated" or is it "amount of memory allocated from the operating system for storing objects". Or is it something else? I think it is memory allocated from the OS, but would like a confirmation. ...

How does a server judge a session to be expired (PHP) and how can the expiry time be changed?

Hello, I've been trying to learn how to use PHP sessions but I'm going around in circles. I understand that a session cookie can be given a lifetime ('session.cookie_lifetime') and that after that lifetime the cookie expires regardless of if a user interacts with the site. I would therefore assume to set this to 0 to indicate they should...

Does a using block create and maintain a reference for the GC?

This is mostly for curiosity's sake, as there are better ways of implementing almost any use case I can think of for this construct (in C# and other languages I use regularly, at least), but I recently saw on here a scoped mutex which was a cool concept. My question is, does the using statement maintain a reference (ie: prevent the GC f...

Java GC: top object classes promoted (by size)?

Hello! Please let me know what is the best way to determine composition of young generation memory promoted to old generation, after each young GC event? Ideally I would like to know class names which are responsible say, for 80% of heap in each "young gen -> old gen" promotion chunk; Example: I have 600M young gen, each tenure promo...

How to handle many updating objects efficiently in C#?

I'm developing a 2D overhead shooter game using C# and XNA. I have a class that I'll call "bullet" and need to update many of these instances every fraction of a second. My first way to do this was to have a generic List of bullets and simply remove and add new bullets as needed. But in doing so the GC kicks in often and my game had som...

Find pointers from pointee

From this code: int x = 5; int other = 10; vector<int*> v_ptr; v_ptr.push_back(&x); v_ptr.push_back(&other); v_ptr.push_back(&x); Is there anyway I can know who points at x, from the x variable itself, so that I don't have to search inside v_ptr for address of x? Is this possible in C++ or C++0x? I read that when doing garbage col...

Will GC collect an object with function pointers?

Hi everyone, just a quick question. First of all, let me verify that I have the correct meaning of a function pointer. In the case of C#, a function pointer is basically just an event function am i right? second, consider the following snippet: public FormAnimator(Form form) { this.m_Form = form; this.m_Form.Load += ne...

Do value types get Garbage collected?

I know that reference type will be garbage collected. I wanted to know whether value types will also be garbage collected from the stack? ...

When and how is a java classloader marked for garbage collection?

We are creating multiple child classloaders to load in multiple subapplications into a Java application "container", prototyping hot deployment. When the classpath of a particular classloader has changed (i.e. jars have been added, deleted, updated), the old classloader is thrown away (unreferenced) and a new classloader is created for ...

C#: Is there any way to easily find/update all references to an object?

I've been reading Rockford Lhotka's "Expert C# 2008 Business Objects", where there is such a thing as a data portal which nicely abstracts where the data comes from. When using the DataPortal.Update(this), which as you might guess persists 'this' to the database, an object is returned - the persisted 'this' with any changes the db made t...

Garbage Collection

Hi All, I am not able to understand few things on the Garbage collection. Firstly, how is data allocated space ? i.e. on stack or heap( As per my knowledge, all static or global variables are assigned space on stack and local variables are assigned space on heap). Second, GC runs on data on stacks or heaps ? i.e a GC algorithm like ...

Removing Tween For Garbage Collection in AS3

i'm trying to remove a tween object after it has complete so the memory can be freed by garbage collection. in this example i'm passing the fadeIn function a UILoader object that is cast as a sprite so that it fades in when it is finished loading. when the tween finishes animating, i want to remove the tween object. i've included the ...

Do I have to release all the native resource before a GC happens?

We know that .NET has 2 super types. The Value-Type and Reference-Type. As I understand it, after I set all the roots of an Ref-Type object to null, the Ref-Type object is logically deleted from the stack, but remains in existence on the manged-heap. If the Ref-Type object uses some native resources, such as an opened-file, do I have to ...

What are the issues with preallocating objects in Java?

We've spent the last few months tuning our production application so that we experience no full GCs. We now experience young GCs only, with the rate of young GCs dependent on the rate of object allocation. Our application needs to be as close to "real-time" as possible so now we're trying to reduce the number of young GCs. As the old ax...

GC with C# and C++ in same solution

I have a solution consisting of a number of C# projects. It was written in C# to get it operational quickly. Garbage collections are starting to become an issuewe are seeing some 100 ms delays that we'd like to avoid. One thought was to re-write it in C++, project by project. But if you combine C# with unmanaged C++, will the threads...