Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to release object stored in property?
Message
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
C# 3.0
OS:
Windows XP SP2
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01397173
Message ID:
01397447
Vues:
39
>
>I use ANT profiler to trace the memory, and I found that some objects is not released (new object created) after every postback.
>
>1. MyBO.SomeEvent
>2. Button
>3. MyDataGridView
>
>Question: How could I free up them upon every postback? In which event/method should I place code to nullify the child object?
>

Try unhooking the event handler from your business object in the Page_Unload(). It's probably keeping the business object from being cleaned up by the GC. You can also set your property to null here if you want (although it shouldn't be necessary).
protected void Page_unLoaded(object sender, EventArgs e)
{ 
   this._myBO.SomeEvent -= this.MyBO_SomeEvent;

}
-Paul

RCS Solutions, Inc.
Blog
Twitter
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform