Hi I just picked up Obj-C and quite dislike its manual memory management.
I decide to go with its Garbage Collection, by adding
objc_startCollectorThread();//garbage collection
in my Main() and change the garbage collection value to [-fobjc-gc]
So is that all I need? So I can program "freely" like I do in Java/Python..etc?
...
I found this piece of code inside System.Web.ISAPIRuntime using Reflector
public void DoGCCollect()
{
for (int i = 10; i > 0; i--)
{
GC.Collect();
}
}
Can anyone comment on this? Is there a reason to do GC.Collect() in a loop? Why 10 times and not 3, 5 or 20? Analysis indicated that it's not used inside .net framew...
Hi I have a SharePoint WebPart that I made and I override the Render method. My question is how long does an object live before the GC cleans it up? I created a StringReader object in the Render function, I am just wondering will it be disposed of once the page has rendered or will I have to explicitly call the .Close method.
Could ...
Hi just to clairfy if I have the following:
using (Object1) {
create Object2
}
// bookmark1
Will Object2 be destroyed at bookmark1 along with Object1?
Object2 is of StringReader and Object1 is of MemoryStream.
...
If you create 10,000 strings in a loop, a lot of garbage collection has to take place which uses up a lot of resources.
If you do the same thing with symbols, you create objects which cannot be garbage collected.
Which is worse?
...
Hi,
When a JSP finishes execution, will all variables declared in the JSP page be put up for garbage collection? If I declare a number of memory intensive Hashtables in the JSP, and I let the JSP finish execution without setting the variables to null beforehand, will the object stay in memory even after the JSP has finished executing?
...
Start with these simple classes...
Let's say I have a simple set of classes like this:
class Bus
{
Driver busDriver = new Driver();
}
class Driver
{
Shoe[] shoes = { new Shoe(), new Shoe() };
}
class Shoe
{
Shoelace lace = new Shoelace();
}
class Shoelace
{
bool tied = false;
}
A Bus has a Driver, the Driver has t...
Objective-C v2.0 (which is what the mac uses) got a new feature, Garbage Collection. I'm a kid on a Linux PC (Ubuntu in case your wondering). So my question is, using the gcc/g++ compiler is Objective-C Garbage Collected?
...
Maybe the most typical example is the JDBC closing done wrong way and not handling the possible exceptions correctly. I am very curious to see other examples you have seen - preferably web application related.
So, are there any common leak patterns in Java?
...
I think I read somewhere recently (might even have been on SO but I can't find the question) that in a debug session, pressing stop in VS just kills the process and no GC takes place. However closing the app window normally performs GC as expected.
Is this correct?
Also, what happens when a (non-debug) process is killed in task manager...
I'm learning C#. From what I know, you have to set things up correctly to have the garbage collector actually delete everything as it should be. I'm looking for wisdom learned over the years from you, the intelligent.
I'm coming from a C++ background and am VERY used to code-smells and development patterns. I want to learn what code-...
When using openGL in Java (in bindings like jogl), do you have to worry about memory management? Does the JVM do garbage collection with the created openGL objects? If so, what's the best way to approach cleanup?
...
Scenario: over 1.5GB of text and csv files that I need to process mathematically. I tried using SQL Server Express, but loading the information, even with BULK import takes a very long time, and ideally I need to have the entire data set in memory, to reduce hard disk IO.
There are over 120,000,000 records, but even when I attempt to fi...
Another question I thought for sure would have been asked before, but I don't see it in the "Related Questions" list.
Could you C++ developers please give us a good description of what RAII is, why it is important, and whether or not it might have any relevance to other languages?
I do know a little bit. I believe it stands for "Resour...
We're running a fairly complex app as a portlet on Websphere Portal Server 5.1 on AIX using IBM JDK 1.4.2. On our production system I can see a strange behaviour in the verbose GC logs. After a period of normal behaviour the system can start rapidly allocating larger and larger blocks. The system starts to spend > 1000 ms to complete eac...
I have several structs bound with Data_Wrap_Struct to ruby objects and I also supplied mark() and free() functions.
When I manually start the GC or just wait until it jumps in my ruby objects are killed.
Nothing new so far.
The strange thing is: When I try to protect these objects with rb_gc_register_address() nothing happens - my o...
I want to make my own malloc/free so I can make a precise copying allocator.
Any gurus have any tips and suggestions?
I have a few questions for now:
Should I just malloc large chunks of memory, and then distribute from that so I don't have to call the system calls?
How are copying collectors usually done? I would imagine that this p...
I am seeing high pgfree/s values in sar for an application. Generally is this an issue I should be concerned about? If so, what is generally the cause, spending time lots of time in GC?
...
I'm a bit confused with JavaScript's delete operator. Take the following piece of code:
var obj = {
helloText: "Hello World!"
};
var foo = obj;
delete obj;
After this piece of code has been executed, obj is null, but foo still refers to an object exactly like obj. I'm guessing this object is the same object that foo pointed to.
...
If I am hosting a long running application such as a web server within a Common Lisp image, what strategy should I use to manage the garbage collector?
I'm assuming that, by default, the garbage collector is entitled to spend long periods of time sorting out the heap, at times I can't predict. This may impact a particular browser reques...