Memory leak SF BO with DevExpress ASPxDataGridView


Author
Message
Trent Taylor
Trent Taylor
StrataFrame Developer (13K reputation)StrataFrame Developer (13K reputation)StrataFrame Developer (13K reputation)StrataFrame Developer (13K reputation)StrataFrame Developer (13K reputation)StrataFrame Developer (13K reputation)StrataFrame Developer (13K reputation)StrataFrame Developer (13K reputation)StrataFrame Developer (13K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Sorry that this has taken so long, but in this instance, there is no memory leak and nothing wrong within the SF code or WBBS class.

We do not have DevExpress 8.2 downloaded and tested this using version 8.1.1.0.  When bringing in all 20,000 records, which is unrealistic, it was very slow but there was not a memory leak.  DevExpress is re-evaluating all rows with each navigation forward.

We reduced the query to the top 200 records for a control to look for any type of memory leak, and we actually noticed the memory being cleaned up and getting smaller.  As expected, the memory grew the first few page navigations, but after about the 5th navigation, the memory consumption reduced and began to keep a more level memory base.

I believe that your issue is one of two things:

  1. A possible issue with the DevExpress 8.2 grid not cleaning up after itself.
  2. Your application is loading too much data and not cleaning up BOs which could cause a memory bloat before there is ever a chance to clean up.

Finally, the WBBS is entirely different than the WinForms BBS.  The Web BBS does not create a unique BO instance for each row.  There is only ever a single BO instance ever used or created.  So the same issue that existed within the WinForms version is not possible on the web.  After looking over the code, we cannot even see where a potential memory leak may occur.

Hope this helps give some direction.  Thanks.

ChanKK
ChanKK
StrataFrame User (472 reputation)StrataFrame User (472 reputation)StrataFrame User (472 reputation)StrataFrame User (472 reputation)StrataFrame User (472 reputation)StrataFrame User (472 reputation)StrataFrame User (472 reputation)StrataFrame User (472 reputation)StrataFrame User (472 reputation)
Group: Forum Members
Posts: 190, Visits: 1.3K
Hi,

Shall you please test using DevExpress 8.2?

I will ask DevEx team to test as well. However, it might takes another day for response which I am not afford to wait anymore.



Thank you for help.
ChanKK
ChanKK
StrataFrame User (472 reputation)StrataFrame User (472 reputation)StrataFrame User (472 reputation)StrataFrame User (472 reputation)StrataFrame User (472 reputation)StrataFrame User (472 reputation)StrataFrame User (472 reputation)StrataFrame User (472 reputation)StrataFrame User (472 reputation)
Group: Forum Members
Posts: 190, Visits: 1.3K
Trent L. Taylor (03/18/2009)



Finally, the WBBS is entirely different than the WinForms BBS. The Web BBS does not create a unique BO instance for each row. There is only ever a single BO instance ever used or created. So the same issue that existed within the WinForms version is not possible on the web. After looking over the code, we cannot even see where a potential memory leak may occur.





Hi,

I used to debug my web app, and found that the code below is called for every row populated by ASPxGridView. If referring to the code below, it create new instance BO for each call and stored it into _BusinessObjectList. Therefore, I feel a bit curious about what you mentioned as above. Please advice. Thank you



Private Function CreateShareAndAddBusinessObject(ByVal index As Integer) As BusinessLayer

'-- Create a new object

Dim loReturn As BusinessLayer = CType(Activator.CreateInstance(Me._BusinessObject.GetType()), BusinessLayer)



'-- Share the table

Me._BusinessObject.ShareCurrentDataTable(loReturn)



'-- Set the parent business object of the instance object

loReturn.ParentBusinessObject = _BusinessObject.ParentBusinessObject



'-- Add the object to the list

Me._BusinessObjectList.Add(index, loReturn)



'-- Return the new object

Return loReturn

End Function


Trent Taylor
Trent Taylor
StrataFrame Developer (13K reputation)StrataFrame Developer (13K reputation)StrataFrame Developer (13K reputation)StrataFrame Developer (13K reputation)StrataFrame Developer (13K reputation)StrataFrame Developer (13K reputation)StrataFrame Developer (13K reputation)StrataFrame Developer (13K reputation)StrataFrame Developer (13K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
That particular method doesn't play into this. However, we have made a change to the enumerator which could have a potential leak in this scenario.  We created a situation with an enumerator that would force a leak and with the change, it resolved the issue.  So I think that this will resolve your problem altogether.  I will send you a PM with the link for the download.
ChanKK
ChanKK
StrataFrame User (472 reputation)StrataFrame User (472 reputation)StrataFrame User (472 reputation)StrataFrame User (472 reputation)StrataFrame User (472 reputation)StrataFrame User (472 reputation)StrataFrame User (472 reputation)StrataFrame User (472 reputation)StrataFrame User (472 reputation)
Group: Forum Members
Posts: 190, Visits: 1.3K
Hi,

I have tested with the fix you sent, but when refresh the page, it hit error as below, which didn't happen before this fix.



System.NullReferenceException was unhandled by user code

Message="Object reference not set to an instance of an object."

Source="MicroFour StrataFrame Business"

StackTrace:

at MicroFour.StrataFrame.Business.BusinessBindingSource.BusinessObject_CurrentDataTableRefilled()

at MicroFour.StrataFrame.Business.BusinessLayer.raise_CurrentDataTableRefilled()

at MicroFour.StrataFrame.Business.BusinessLayer.OnCurrentDataTableRefilled()

at MicroFour.StrataFrame.Business.BusinessLayer.ChangeCurrentDataTable(DataTable NewTable, Boolean AcceptChanges, Boolean IsSharedTable)

at MicroFour.StrataFrame.Business.BusinessLayer.FillDataTable(String SelectStatement)

at WebApplication8._Default.Page_Load(Object sender, EventArgs e) in C:\Documents and Settings\KKCHAN\My Documents\Visual Studio 2008\Projects\WebApplication8\Default.aspx.cs:line 20

at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)

at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)

at System.Web.UI.Control.OnLoad(EventArgs e)

at System.Web.UI.Control.LoadRecursive()

at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

InnerException:





Shall you please test using the attachment I posted in previous post and DevExpress 8.2 to ensure the issue could be fixed? It has taken too long time for this, and also because of our timezone, we might not response immediately cause some unnecessary delay.



Thank you
Trent Taylor
Trent Taylor
StrataFrame Developer (13K reputation)StrataFrame Developer (13K reputation)StrataFrame Developer (13K reputation)StrataFrame Developer (13K reputation)StrataFrame Developer (13K reputation)StrataFrame Developer (13K reputation)StrataFrame Developer (13K reputation)StrataFrame Developer (13K reputation)StrataFrame Developer (13K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Sorry, this exception was easily reproducable and we already have a fix.  I will send you a PM with a link to download the Business assembly.  This is the only thing that changed.
ChanKK
ChanKK
StrataFrame User (472 reputation)StrataFrame User (472 reputation)StrataFrame User (472 reputation)StrataFrame User (472 reputation)StrataFrame User (472 reputation)StrataFrame User (472 reputation)StrataFrame User (472 reputation)StrataFrame User (472 reputation)StrataFrame User (472 reputation)
Group: Forum Members
Posts: 190, Visits: 1.3K
Hi,

I tested it and it fixed the problem. I will release it to our QC for further testing, will update you if any news. Thank you for your help on this. You safe my life!



Thank you
ChanKK
ChanKK
StrataFrame User (472 reputation)StrataFrame User (472 reputation)StrataFrame User (472 reputation)StrataFrame User (472 reputation)StrataFrame User (472 reputation)StrataFrame User (472 reputation)StrataFrame User (472 reputation)StrataFrame User (472 reputation)StrataFrame User (472 reputation)
Group: Forum Members
Posts: 190, Visits: 1.3K
Hi,

After some more testing, I still found "memory leak". When I doing data entry/refresh/Callback the page (few times), the memory will be increasing and reach about 100-120MB. Then, it will drop about 80-90MB and increasing again. And we can see that, for every "drop", that is about 20-30MB is not clearly cleaned. Once it run for certain period (about 40 records entered), w3wp.exe will eat up 700MB (based on machine) and OutOfMemoryException occurred.



I use dottrace to snapshot memory and found that are at least 300MB garbage object in memory, System.String[], DataTime[], Datetime, DataRow, RBTree.Node[], String and etc.



May I know what cause this problem? Is it caused by DataBinding or...? How could I prevent this?



I have attached the screenshot. Please advice. Urgent!
Attachments
garbage.JPG (217 views, 112.00 KB)
Trent Taylor
Trent Taylor
StrataFrame Developer (13K reputation)StrataFrame Developer (13K reputation)StrataFrame Developer (13K reputation)StrataFrame Developer (13K reputation)StrataFrame Developer (13K reputation)StrataFrame Developer (13K reputation)StrataFrame Developer (13K reputation)StrataFrame Developer (13K reputation)StrataFrame Developer (13K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Chan,

The screen shot you provided doesn't do me any good.  We have taken the sample that you have provided and NOT had the same results.  You already know that if we are to help you we are going to need some form of reproduction otherwise there is nothing we can do for you.  Please provide a sample that reproduces the issue.  I would strongly suggest that you make sure that you have the most recent build and assemblies loaded that I sent to you the other day.  I never posted the source online, so if you recompiled the source, then you are not running the most recent build.

This has happened to you in the past where you accidentally had the wrong version of the assemblies in your environment.  Using the most recent StrataFrame assemblies, we are not experiencing this using a WBBS and a grid.  However, I will not say that the possibility of what you are experiencing doesn't exist...but without a sample that we can reproduce on our side, there is very little I can do in this type of circumstance.

ChanKK
ChanKK
StrataFrame User (472 reputation)StrataFrame User (472 reputation)StrataFrame User (472 reputation)StrataFrame User (472 reputation)StrataFrame User (472 reputation)StrataFrame User (472 reputation)StrataFrame User (472 reputation)StrataFrame User (472 reputation)StrataFrame User (472 reputation)
Group: Forum Members
Posts: 190, Visits: 1.3K
Hi,

OK, I will prepare sample for it.



However, I would like to double clarify with you, the MicroFour StrataFrame Business.dll shipped with latest Setup (fix thread safe issue) is version 1.6.6.9 and file size 781KB? Because the hot fix that you sent me last time (fix memory leak) is 1.6.6.8 with file size 801KB. I was thinking you 1.6.6.8 might contains debug info therefore is larger.



Does 1.6.6.9 include the memory leak fix as well?



Please advice.



Thank you
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search