ID:151287
 
I was wondering if, since the project I'm working on is already fairly well done (yet not very efficient), it it was possible for me to be lazy and simply override the Del() proc for an object and simply set the reference variables it has to null as well as its loc and allow the garbage collector to take it from there. I ask this because I realize del() calls Del() at some point but I wasn't sure if I would have to go through the entire source code and redo each del() by itself or if this override would suffice and ultimately save some processing power and memory.
I don't think overriding Del() to try to force a soft delete will really work. To get a soft delete, it's better to just do that in the first place.
In response to Lummox JR
I was afraid someone would say that. I wish I had been more aware of the salvation that the garbage collector offered to my processor far beforehand. Oh well. Learn from your mistakes I suppose.

Edit: So how long does it take for the garbage collector to actually delete an object once its reference variables have been cleared, references to it cleared, and its loc set to null?
In response to DarkMoonProductions
An arbitrary amount of time. Could be instant, could be a while from now. You shouldn't ever write code that depends on the GC collecting something in a certain amount of time. (with the exception that you don't have to worry about memory - if memory gets so full that you can't new something, the GC will run)
In response to Jp
Jp wrote:
An arbitrary amount of time. Could be instant, could be a while from now. You shouldn't ever write code that depends on the GC collecting something in a certain amount of time. (with the exception that you don't have to worry about memory - if memory gets so full that you can't new something, the GC will run)

This is incorrect. If an object's references expire, it is immediately deallocated and any references it holds are decremented.
In response to Lummox JR
Right, reference-counting collector. Was thinkin of Java-style mark-and-sweep.

Still probably shouldn't rely on the GC collecting right then, though.