This is a migrated thread and some comments may be shown as answers.

Memory Leaks

3 Answers 125 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Juan Carlos Ramirez Orozco
Top achievements
Rank 1
Juan Carlos Ramirez Orozco asked on 01 Jul 2011, 04:09 PM
Hello,
We have a problem using the telerik controls on a form, 
a memory occupied  problem, but never freedthe form uses the following controls:
• 3 DataTable.
• 1 DataSet.
One of the DataTable is populated with 10,000 records and the other 2 with 5 records, more records DataTable is populated as follows:

dtDataTable.Add("Ide", typeof(int));

 

dtDataTable.Columns.Add(

"Nom", typeof(string));

 

 

foreach (Objeto oObjeto in ArrayObjetos)

 

{

 

DataRow drRow = dtDataTable.NewRow();

 

drRow [

"Ide"] = oObjeto .Ide;

 

drRow [

"Nom"] = oObjeto.Name + " " + oObjeto.LastName;
dtDataTable.Rows.Add(drRow );

 

}


The 15 MB memory increases by this load but the release (close) is in use 8 MB of those 15.
The Close () the form we make the following:

if(dtDataTable != null)

 

    dtDataTable.Clear();

dtDataTable=

null;

 

if(dtDataTable1 != null)

 

    dtDataTable1.Clear();

dtDataTable1=

null;

 

if(dtDataTable2 != null)

 

    dtDataTable2.Clear();

dtDataTable2=

null;

 

 

 

 


The question is, We are releasing resources correctly or the problem may be the way I'm filling?
Thank you very much.

 

 is in use 8 MB of those 15.The Close () the form we make the following:if;if;if;

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

3 Answers, 1 is accepted

Sort by
0
Jack
Telerik team
answered on 05 Jul 2011, 02:02 PM
Hi Juan Carlos Ramirez Orozco,

Thank you for contacting us. 

You should dispose all objects that support the IDisposable interface by calling their Dispose method. This includes the DataTable object and the form itself. The following code snippet demonstrates how to do this:
if(dtDataTable1 != null)
{
    dtDataTable1.Dispose();
    dtDataTable1 = null;
}

Please note that our controls reserve some memory for static resources such as themes and this memory is not disposed until the application exits. If you think that a memory leak still exists, please send us your application and we will investigate it in detail.

Should you have any other questions, do not hesitate to ask.
 
Best wishes,
Jack
the Telerik team
Registration for Q2 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting July 18th and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Khizar Khan
Top achievements
Rank 1
answered on 07 Aug 2011, 01:15 PM
hi,

we have some usercontrols which are dynamically created everytime they a case is loaded and disposed when the user clear the data on the application. the footprint of the application is too large like 140 mb when the app load and keep growing, I have used the profiling tool ANTS and upon investigation, it seem the the controls are not disposed properly, It is the theme event which is holding the reference for the fillprimitives.

is it possible to unregister the themeevent so that they are disposed or can you please suggest something so that the memory is freed.

we are mostly using, label, button and dropdownbuttons etc. This bit critical and will appreciate a quick reply as the software is due to be released very soon. thanks for your help in advance.

Regards,
Khizar
0
Peter
Telerik team
answered on 08 Aug 2011, 04:07 PM
Hello Khizar Khan,

Thank you for writing.

In order to produce each release our team performs very strict memory leak tests and every time the results were unambiguous: everything works as expected. For this reason I kindly ask you to send us a sample project in the same-topic support ticket you have opened. In addition, please illustrate the exact steps that we should follow to reproduce the memory leak? This will help us to understand your scenario in depth.

Also, I would like to bring your attention to the fact that the Garbage Collector releases a RadControls instance later than it frees the memory of a less complex control. The reason is that RadControls are second generation Garbage Collector objects. In case you would like to release the memory instantly after the form is closed, you should call the GC.Collect method manually. More information on garbage collection generations can be found here.

Further, I would like to explain that our themes create static objects that remain active in the memory until the application is closed. This can raise the application memory with several megabytes. In addition, the Close() method of a modal form does not dispose it and, therefore, the Garbage Collector cannot free the allocated memory. To avoid this you must call the Dispose() method of the form when it is no longer needed in your application.

Let me know if any of the above explanations help and in case they do not, please provide a sample project in your support ticket. 

Greetings,
Peter
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

Tags
General Discussions
Asked by
Juan Carlos Ramirez Orozco
Top achievements
Rank 1
Answers by
Jack
Telerik team
Khizar Khan
Top achievements
Rank 1
Peter
Telerik team
Share this question
or