Memory usage with controls added dynamically

0
0

Hello,

We are facing an issue with memory consumption in a particular case we have on our costumer system. There is a screen that we need to load a list of components dynamically based on a query. The query returns 9 columns per row, and it can return over 70 rows. For each “cell” of the table, we add a new textbox, button or drop down to the screen, based on the cell content.

So in this example, where the query returns 70 rows, we must add 630 fields on the screen, and when this happens the memory usage of the w3wp process goes from 130 MB to 670MB and this memory is never released, even if the user closes the page. When the user decides to open once again the same list, memory consumption goes over 1 GB, and this growth continues until we have to reset the IIS process.

I know that 630 fields is a lot, however, our costumer used a system before ours that had the same screen, but built with HTML with C# and the memory consumption for the same case grows only 5MB.

Is there a solution that we can use to control this memory growth, or a way to release this memory once the fields are rendered on the client side?

If you need more information, please let me know.

Thanks in advance!

  • You must to post comments
0
0

You should use the DataRepeater. Can handle millions of items from the data source and only create the visible items.

In your case if the memory is not released it means your code is holding on a reference to the controls. Wisej only keeps weak references and even if the app “forgets” to dispose controls they get disposed automatically. You can check easily using VS memory snapshots and compare before/after to find the GC root.

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.