hi !!
i have a form with 4 grid that are connected to each other via data relations.
the grid have some checkboxes, textfields and dropdowns.
total around 10 datatables.
when user clicks reload on data and to a grid.datasource = ds on the tables again. for some reason the data isnt released.
1. is it possible to prevent initializelayout to be called (first time should be enough) ?
2. whats the correct way of doing this ?
i use 2008 vol 3, but have also tried with 2010 vol 2.
regards,
Geir Sanne
Hi Geir,
There's very little information here to go on. Are you disposing the DataTables you created in your DataSet when you create new ones?
goggi said:1. is it possible to prevent initializelayout to be called (first time should be enough) ?
InitializeLayout fires any time the grid's DataSource/DataMember are changed or any time the DataSource sends a reset notification. It's not supposed to only fire the first time - that would defeat the purpose of the event.
You could skip the code in this event using a flag if you want, or you could disable the event using the grid's EventManager. But that's not really how it is intended to work and it seems like a very odd thing to do. I don't understand how that would help you.
goggi said:2. whats the correct way of doing this ?
Correct way of doing what, exactly? Binding and then re-binding the grid? There's no one single correct way, it depends on the needs of your application. But if your application is leaking memory, then it's mostly likely because you are creating objects that you are not properly disposing of. These will get cleaned up by the DotNet garbage collector at some point, anyway, so it's usually not a big deal, unless your application is constantly increasing memory usage to the point where this affects the system as a whole.
ive tried to dispose the old datasets, but there is no difference when i do dispose and when i dont. they get disposed after a while anyway.
so if i want to reload data i can just do grid.datasource = ds; ?
and then the old layouts, bands, columns, etc. should be disposed by itself ?
i have a form with the grids where i reload the data every 10 seconds. i let it stay like this for 24 hrs.
then i stop the autorefresh and force a couple of GCs, but still the app uses about 100 MB more than when i started the app.
in windbg i can see that these types increase in size :System.EventHandlerSystem.Stringsystem.ControlEventHandlerSystem.ObjectMouseEventHandelrWeakReferenceUltraGridUIElementUltraWinGrid.CaptionAreaUIElemenTInfragistics.Win.UltraWinGrid.DataAreaUIElementInfragistics.Win.ControlUIElementBase+MouseEventManager
ive tried to look at all the types that increase but everything points to a infragistics .dll so im not sure what to do.
EEClass: 04a86b28Module: 003cebc0Name: Infragistics.Win.ControlUIElementBase+MouseEventManagermdToken: 02000111File: C:\Windows\assembly\GAC_MSIL\Infragistics2.Win.v10.2\10.2.20102.2058__7dd5c3163f2cd0cb\Infragistics2.Win.v10.2.dllBaseSize: 0x28ComponentSize: 0x0Slots in VTable: 19Number of IFaces in IFaceMap: 1--------------------------------------MethodDesc Table Entry MethodDesc JIT Name7181a7e0 715f4934 PreJIT System.Object.ToString()7181e2e0 715f493c PreJIT System.Object.Equals(System.Object)7181e1f0 715f495c PreJIT System.Object.GetHashCode()718a1600 715f4970 PreJIT System.Object.Finalize()718b5aa0 71677f58 PreJIT System.MarshalByRefObject.GetLifetimeService()71817e94 71677f60 PreJIT System.MarshalByRefObject.InitializeLifetimeService()7185bf0c 71677f68 PreJIT System.MarshalByRefObject.CreateObjRef(System.Type)06aa3a60 0147ca5c JIT Infragistics.Shared.DisposableObject.Dispose()067ede90 04ac2d5c JIT Infragistics.Win.ControlUIElementBase+MouseEventManager.OnDispose()04e0cd20 04ac2d64 JIT Infragistics.Win.ControlUIElementBase+MouseEventManager.HookControl(System.Windows.Forms.Control)0162ff1d 04ac2d6c NONE Infragistics.Win.ControlUIElementBase+MouseEventManager.UnhookControl(System.Windows.Forms.Control)0162ff80 04ac2d50 JIT Infragistics.Win.ControlUIElementBase+MouseEventManager..ctor(Infragistics.Win.ControlUIElementBase)067f77b0 04ac2d74 JIT Infragistics.Win.ControlUIElementBase+MouseEventManager.StartTimer(System.Windows.Forms.Control)067f7830 04ac2d80 JIT Infragistics.Win.ControlUIElementBase+MouseEventManager.StopTimer()04df1a68 04ac2d8c JIT Infragistics.Win.ControlUIElementBase+MouseEventManager.OnMouseEnter(System.Object, System.EventArgs)04df1a78 04ac2d98 JIT Infragistics.Win.ControlUIElementBase+MouseEventManager.OnMouseLeave(System.Object, System.EventArgs)04df1a88 04ac2da4 JIT Infragistics.Win.ControlUIElementBase+MouseEventManager.OnMouseMove(System.Object, System.Windows.Forms.MouseEventArgs)04df1a58 04ac2db0 NONE Infragistics.Win.ControlUIElementBase+MouseEventManager.OnMouseWheel(System.Object, System.Windows.Forms.MouseEventArgs)067f77c0 04ac2dbc JIT Infragistics.Win.ControlUIElementBase+MouseEventManager.OnTimerTick(System.Object, System.EventArgs)