breaking references to a form C# -


i have license project (database interaction project) , want remove references form loads data db, because load lot of data , memory usage high. profiled application (.net memory profiler, ants) , got references connected form:

module1.cs / class1 -> module2.cs / class2 reference ref 1 written on arrow

i must remove them without drastic changes, , program should still work :). if put references null program crashes because might need refs again trouble is, think, reference showed can declared in different modules ones showed profiler, making harder follow.

in data.cs have data class , in declare

mvcontroller = table.resolve<imvcontroller>(); 

mvcontroller - of type imvcontroller (doesn't matter name) table - of type iunitycontroller imvcontroller - interface mvcontroller declared resolve - makes container of same type mvcontroller

i want know if put mvcontroller = null when no longer needed gc enter / object eligible collection?

or table have hold reference object of type imvcontroller? guess it eligible.

what if object declared:

object newobject = domainobjectfactory.getobject(typeofobject);

then uses mvcontroller:

(newobject class1).methodfromclass1(mvcontroller.property1, mvcontroller.property2, ...);

do rid of reference this:

object = null; collected @ time?

another question: should references passed ref in method (e.g. public void method(ref type obj) make obj = null; in method object null also? refs project point null> gc collect? , call method ref: method (ref obj) when object no longer needed , should go out of scope?

thanks

if put mvcontroller = null when no longer needed gc enter / object eligible collection?

depends on iunitycontroller implementation: if owns imvcontroller, there no profit resetting mvcontroller. anyway, gc not collect garbage until app lack of memory.

make obj = null; in method object null also

if object referenced other variables/objects, gc not collect it. if not, object collected. time.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -