Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
120
"memleak" when rebinding grid
posted

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

 

Parents
No Data
Reply
  • 469350
    Offline posted

    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.

Children