Home > Net >  C # custom controls resource release problem
C # custom controls resource release problem

Time:10-01

Side USES more than one UserControl, display interface, when the business done, want to release this UserControl occupy resources, UserControl without Close method, so it only took the Dispose method, but found in the resources Dispose method did not return to the memory of before, is there any way?

CodePudding user response:

Is anyone here? !!!!!!!!!!!!!!!!!!

CodePudding user response:

Instead of recycling resources, control the Dispose when the.net intelligent processing by the garbage collector,
You can perform GC. Collect () method of the compulsory recycling resources,

CodePudding user response:

refer to the second floor datafansbj response:
control when Dispose the. Net not recycling, but by the garbage collector to intelligent processing,
You can perform GC. Collect () method of the compulsory recycling resources,
tried, also not line,

CodePudding user response:

Others???????

CodePudding user response:

Nobody??????

CodePudding user response:

GC. Collect () just notification operation system for garbage collection, but exactly when to determined by the operating system, we are not sure,

CodePudding user response:

The.net in order to improve performance, may take up quite a lot of memory resources, when too much memory footprint will automatically garbage collection, did not release resources, there are two reasons:
1, memory is not to the.net that need cleaning degree (such as system has 8 gb of memory, the program USES the 4 g)
2, the program needs to use lots of resources, will can't release, otherwise the program logic error (such as creating too many objects)

CodePudding user response:

Back to the initial control,

CodePudding user response:

refer to 7th floor datafansbj response:
.net in order to improve performance, may take up quite a lot of memory resources, when too much memory footprint will automatically garbage collection, did not release resources, there are two reasons:
1, memory is not to the.net that need cleaning degree (such as system has 8 gb of memory, the program USES the 4 g)
2, the program needs to use lots of resources, can't release, otherwise the program logic will go wrong (such as creating too many objects)
yes, I have a 4 g computer, before is all interfaces on a List, and use it every time you show, but in this case, the interface is becoming more and more and cause the program to take up more than 1 g, so going to run out of a business interface, dispose, but GC haven't recovery, cause the program appear all sorts of problems,

CodePudding user response:

refer to the eighth floor exception92 response:
initial control again,
new again, but before the release of resources recycling, also don't know when the GC recycling, cause the program memory is more and more,

CodePudding user response:

references to the tenth floor lfc6329356 response:
Quote: refer to the eighth floor exception92 response:

Initial control again,
new again, but before the release of resources recycling, also don't know when the GC recycling, cause the program memory is more and more,

Custom controls whether contain unmanaged resources, contain words need to manually release,

CodePudding user response:

You mean the business done,
Refers to the current UserControl, not be cited?
If there is interface, so the GC how recovery

CodePudding user response:

refer to 12th floor is nu month god reply:
do you mean the business done,
Refers to the current UserControl, not be cited?
If there are interface, so the GC how recycling
is not quote again, and then the Dispose off, see memory did not recover before
  •  Tags:  
  • C#
  • Related