Hi unfortunately I'm not so good in the whole garbage collection thing. Now I am unsure if I'm going to get into trouble if I'm doing the following:
// unmanaged Class
class CUnmagedClass : public CCmdTarget
{
auto_gcroot<Dictionary<int, System::String^>^> m_dict;
auto_gcroot<SomeManagedClass^> m_managedClass;
// create fir...
Hello,
In a C# project, I need to pass object parameters by putting references in a structure.
i.e. I have a structure passed to a dispatcher
struct SOMESTRUCT
{
public int lpObject;
}
Where lpObject holds a pointer to a custom object like
class SomeClass
{
private string foo;
}
And the SOMESTRUCT structure is passed from ...
Possible Duplicate:
Garbage Collection in C++ why?
Hi, I read few articles about Garbage Collectors, and still there is one thing I just don´t understand - why use garbage collection?
I will try to explain my thoughts:
Garbage Collector should release dynamically allocated memory back to system in case there is no need for ...
When using SqlConnection, it's important to always close it when used - either by .Close() or placing the SqlConnection in a "using". Unfurtunately, people, including myself, tend to forgot that and this is where the garbage collectors rescues me for a while until i've forgot to close my connections too many times or the number of people...
Hi, I want to know what action is performed when we call Dispose() method. Is Object frees all resources quickly on Dispose() call or Dispose() marks the Object is ready for garbage collection. And What happened when we set Object reference to NULL. Actually I have Windows form application in .NET 2.0. And I want to call garbage collecto...
Are there any "good" C libraries for garbage collection?
I know about the Boehm GC, is it maintained nowadays?
What about http://tinygc.sourceforge.net?
What are your experiences with these libraries?
...
Hi All,
It is written in link http://msdn.microsoft.com/en-us/magazine/bb985010.aspx
"When an application creates a new object, the new operator allocates the memory from the heap. If the object's type contains a Finalize method, then a pointer to the object is placed on the finalization queue."
Can someone please clarify me
1) It m...
I have a question about how garbage collection might be handled in a linq query.
Suppose I am given a list of requests to process. Each request generates a very large set of data, but then a filter is applied to only keep critical data from each requested load.
//Input data
List<request> requests;
IEnumerable<filteredData> results = re...
OK, I realize that question might seem weird, but I just noticed something that really puzzled me... Have a look at this code :
static void TestGC()
{
object o1 = new Object();
object o2 = new Object();
WeakReference w1 = new WeakReference(o1);
WeakReference w2 = new WeakReference(o2);
GC.Collect...
Hi, are there any CLR implementations that have deterministic garbage collection?
Nondeterministic pauses in the MS CLR GC inhibit .Net from being a suitable environment for real-time development.
Metronome GC and BEA JRockit in Java are two deterministic GC implementations that I'm aware of.
But have there any .Net equivalents?
Than...
Why does constructor not required in structure ?
Why does GC don't remove structures ?
...
Hey There
Knowing nothing about the GC and never having the need to use it (or so i think), what is a typical use there of, and how can i / my system benefit if i up skill myself and learn more about the GC?
UPDATE
...how can i make things easier for the GC?
...
Suppose I do the following in java for a process that stays open:
import java.io.File;
import java.util.Date;
public class LogHolder {
public static void main(String[] args) {
File file1 = new File("myLogFile.log");
while (true) {
System.out.println("Running " + new Date());
}
}
}
Ha...
Hi,
I have a very basic question.
I write a loop like this:
while(true)
{
MyTestClass myObject = new MyTestClass();
}
When will be the object created in
the loop, garbage collected?
Also, for every iteration, is it
that the new memory location is
allocated to the myObject reference?
What if i write myObject = null; at the end o...
Hey all,
I think my question may be related to this question here but i'll ask it anyway!
If I have three objects: A, B and C where
A references B
A references C
B references C (and vice versa, cyclical)
will the B->C reference cause A to not be garbage collected when it might otherwise be collected?
...
Hi,
i am trying to create an background thread that updates a Runnable at a given interval.
It should also not prevent the "parent" from beeing garbage collected.
My problem is as follows. My WeakReference seems to act as a "strong" Reference, It doesn't stop my thread form accessing the runnable that i am supposed to have made availab...
Is it conceivable that the rate at which new objects are created by a Java program somewhat exceeds the rate at which these objects are garbage collected in the young generation ?
...Thus causing an ever greater backlog of new objects sitting on the heap until a full gc is triggered ?
Any metrics I could collect to identify/verify thi...
i have a stupid question, but i want to hear the community here.
So here is my code:
using (FtpWebResponse response = (FtpWebResponse)request.GetResponse())
{
return true;
}
My question, is it any different than:
(FtpWebResponse)request.GetResponse();
return true;
Which one is better in general? which one in terms of GC ...
Most of the modern languages have built in garbage collection (GC). e.g. Java, .NET languages, Ruby, etc. Indeed GC simplifies application development in many ways.
I am interested to know the limitations / disadvantages of writing applications in GCed languages. Assuming GC implemenation is optimal, I am just wondering we may be limite...
Could someone help on this , please?
Q: An application server registers an object in RMI Registry by calling Naming.rebind(). After a while, the server app goes down. Explain what will happen to the object reference registered in the Registry.
A: I think the reference is kept in the Registry for a while, but after that period ("lease p...