StrataFrame Forum

Memory leak SF BO with DevExpress ASPxDataGridView

http://forum.strataframe.net/Topic22309.aspx

By ChanKK - 3/11/2009

Hi,

I am facing memory leak problem when using SF BusinessObject and DevExpress ASPxDataGridView.

I have simple test project, which only has one BO, bind to ASPxDataGridView. It does nothing complicated, just load all records in Page_Load if not IsPostBack.



I found that, the memory usage would become double when I just "refresh" the page. I also used dotTrace profiler and found that # of BO instances keep increasing. I suspect it is the same issue with the post http://forum.strataframe.net/Topic20903-8-1.aspx.



I have prepared sample project and the dotTrace memory profiler files for your reference. MemoryLeak1.dtm is first load memory snapshot and MemoryLeak2.dtm is 2nd snapshot after refresh.



As the file size > 30MB, please download it from http://www.visualsolutions.com.my/blog/chankk/WebApplication6.zip



Hope you could get back to me as soon as possible! It is very urgent!



Thank you
By Trent L. Taylor - 3/11/2009

Are you running the most recent beta of 1.6.7?  A number of memory leak issues in regards to the BBS (which is what you are using I am sure) have already been resolved.  Please load and test the beta before moving forward. 
By ChanKK - 3/11/2009

Hi,

Yes, I am using most recently beta 1.6.7, which I downloaded few days ago.



Please advice. Thank you
By Trent L. Taylor - 3/12/2009

We will set this up.  We are looking to see if the same modifications made to the WinForms BBS were implemented on the web side.  Thanks.
By ChanKK - 3/12/2009

Hi,

Thank you. Hope to hear from you very soon, as the IIS would freeze after refresh/postback the page about 10 times.



Thank you
By Trent L. Taylor - 3/14/2009

We are trying to reproduce at the moment...will let you know when we have something.  We want to get it reproduced before we change anything so that we can ensure that if there is an issue it is resolved before pushing out an update or making changes.
By ChanKK - 3/16/2009

Hi,

May I know any update? Do you think it could be solved in this week?

Sorry for keep approaching you, as we need to deliver in this end of month, without this solved we are not going to release; meanwhile we need to inform customer earlier instead of the of delivery.



Thank you for understanding.
By Trent L. Taylor - 3/18/2009

We are looking at this right now and trying to reproduce.  Should know something later today.  If not, I will let you know.
By Trent L. Taylor - 3/18/2009

Just FYI, your sample is missing the BusinessobjectLibrary6 project.  So we are having to recreate this on our own.  If you can provide that project as part of your sample it may speed things up.
By ChanKK - 3/18/2009

Hi,

I have attached the missing project.

Beside, I spent some time to trace the root cause of this issue and found that, BusinessBindingSource.Dispose() is not called at all. Do you think it is the cause?



Thank you
By Trent L. Taylor - 3/18/2009

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.

By ChanKK - 3/18/2009

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.
By ChanKK - 3/18/2009

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

By Trent L. Taylor - 3/18/2009

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.
By ChanKK - 3/18/2009

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
By Trent L. Taylor - 3/19/2009

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.
By ChanKK - 3/19/2009

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
By ChanKK - 4/14/2009

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!
By Trent L. Taylor - 4/14/2009

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.

By ChanKK - 4/14/2009

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
By Trent L. Taylor - 4/14/2009

Does 1.6.6.9 include the memory leak fix as well?

Yes.  As for the file size, I am unsure why it was smaller other than I might have sent you just that one file in debug mode.  But your assessment is correct.

By ChanKK - 4/14/2009

Hi,

I have created sample project, which is exactly the same as previous one. It only contains 1 BO and DevExpress GridView. I keep reload the page and below is the log of memory taken by each drop



First Load - 52564

First Memory Drop - 55316

Second Memory Drop - 56260

Third Memory Drop - 56284

Fourth Memory Drop - 56400

Fiveth Memory Drop - 57268

and etc



I recorded video. Please download it from



http://www.visualsolutions.com.my/blog/chankk/memory.zip



I also recorded using performance monitor which as attached. During performance monitoring, I found that, the memory will keep increasing, drop, stay at same level for a while, then will increase again for some time (this jump will be almost back to previous before drop level and more), then drop again (but is higher that previous drop), stay for a while and increase again.



The sample project is very simple, therefore the memory leak is not that serious. If I run my web app, it easily eat up few hundred MB.



Sample Project: http://www.visualsolutions.com.my/blog/chankk/WebApplication12.zip



Please advice. Thank you
By ChanKK - 4/16/2009

Hi,

May I know any status?



Thank you
By Trent L. Taylor - 4/18/2009

First, let me apologize for the length of time in getting back to you.  Recently, we have seemed to go back and forth quit a bit with you in this area so I wanted to make sure that we did a thorough test to ensure that there is no memory leak.  In short, we have proven using your very sample that there is no memory leak.  I know that we had given you a build recently with a fix for a memory leak.  However, we wanted to ensure that we did not have anout round of going back and forth on this so we put the sample you sent us (as well as some of our own) to the test.

At no time during these tests did we see any form of a memory leak.  This includes the sample that you sent to us.  If you review the attached video, you will see that the memory never increased but at one point does in fact go back down.  We performed more robust tests that this video shows and setup scenarios where large numbers of postbacks and refreshes were called.  We consistenly saw the memory actually clean up and reduce.

At this point I am uncertain what to tell you other than I do not believe that you are using a build that resolves this issue.  We posted a new build in the last day or so that it may serve you well to install to make sure that you did not run on the incorrect assembly.  I know that this has been an issue in the past.

I hope that this at the very least gives you some direction.  Thanks.

By ChanKK - 4/18/2009

Hi,

Thank you for explanation.

In my sample, I also attached SF dll which I used. You might try to reverse engineer to see if it is the latest, as I don't know what SF team changed for memory leak problem. Therefore, I can't check on behalf.



Beside, if you check my video, it is really eat up some number of MB after every "cleanup". In order not to keep back and forth for this issue again, I will try have last try using the latest build posted 2 days ago. However, I would request SF team to troubleshoot via our machine or our whole application if this build still not solve my problem. It could be our mistake as you suspect I am not using the latest one. Therefore, the best approach is SF team to check for us. My company is willing to pay for it, as we already improved quite number of $$$ and time to this tool. As we only want the issue solved so that we can deliver.



Please consider my suggestion, we are looking for any good news.



Thank you
By ChanKK - 4/18/2009

Hi,

BTW, I have watched the video that you posted. May I know what exe are looking tracing? I am assuming you are looking at iexplorer.exe as it is highlighted. However, memory leak is happens to IIS (w3wp) or ASP.NET web server (WebDev.WebServer) but not web browser. Somemore, I didn't see IIS / ASP.NET WebServer exe appear in task manager in the video as well



Please advice.

Thank you
By ChanKK - 4/18/2009

Sorry, one more thing to add on, I am not sure if SF team just stop investigation once see memory is dropped / clean up after few refresh. In fact, first time clean up doesn't meant the rest will clean up "properly". Just for your info.



Thank you
By Trent L. Taylor - 4/19/2009

Chan,

We have looked at this from a number of angles.  I am at a loss at this point.  Like you, we have spent a vast amount of time trying to help you on this issue.  This doesn't mean that we are not prepared to continue to help, but we have a large number of users that have web applications developed on SF...including ourselves.  Some of your issues are coming from retrieving vast numbers of records into a grid...this is generally not a recommended approach...web or win forms.  However, that being said, I will take one more look.  But at this point, I do not feel like there is a memory leak.  Another reason for this is that the underlying code to which you are referencing here is also call in non-web code which is highly used in reporting and grids on win forms (or binding natively to .NET in win forms).

By ChanKK - 4/19/2009

Hi,

I hope you do not misunderstand me, I do appreciate SF help on this issue. Just that, as we can see we take a lot of time for this, keep back and forth but still not able to solve it (at least at my side). Instead of I keep reporting this issue again and again in future (touch wood), and SF need to re-test again and again, why not we spend some time, whatever approach, to solve it ONCE? Otherwise, it is not able drag OUR time, it also generate bad "image" to others while read the forum. As I don't wish any actions spoil such a good tool.



Anyway, thank you for your help.



Thank you
By ChanKK - 4/19/2009

Hi,

Some of your issues are coming from retrieving vast numbers of records into a grid...this is generally not a recommended approach




What is the better approach? Ask before search?



Thank you
By Trent L. Taylor - 4/19/2009

Chan,

I appreciate your comments.  We too appreciate you and your business. 

What is the better approach? Ask before search?

Most definitely.  There is rarely ever a situation where you need to bring back thousands of records.  There is no way for a user to comprehend that many records anyway.  It is always good practice to limit the number of records that are returned.  Not just due to memory, but for user interaction, comphension, and usability.

Grids, in any environment, can be great tools.  But they can also come with a vast amount of overhead.  Also, they are not always the best solution for presenting a user-friendly experience.

In our medical software there are three places that we use grids.  They all have to do with billing and showing transactions associated with an account or billing claims going out.  However, we still limit the number of records that come back.  There is rarely a need to load up tens of thousands (or even hundreds in many cases) unless they are directly related to the task at hand.

Example, we had a patient that had over 6000 transactions (that would translate into about 3000 visits to the doctor or so).  That is CLEARLY not the norm for most environments.  But it was the upper end for sure.  When this was loaded into the grid, we made sure it was optimized for this type of experience.  But this was still too much for the end-user to comprehend.  So we have searches and filters to make the data usable...and limit records as well.  6000 records really isn't that many for a grid on WinForms to handle...but for the web....this would be next to impossible to use.  So we apply a filter or search PRIOR to showing the records while still showing summaries and totals for the full record set.  Make sense?

These are just development techniques that make life better for both the developer as well as the end-user.

By ChanKK - 4/22/2009

Hi,

Any status?



Beside, as promised I have downloaded the latest SF setup and try again. It hit another error.



By using the setup 1.6.6.9 which dated 5th, Apr, it is working fine. However, once we setup 1.6.6.9 dated 17th, Apr, the following error occurred.



Now, we have reverted back to 4th, Apr one and now is working fine.



Please advice



Server Error in '/FlexHR' Application.



--------------------------------------------------------------------------------



This SqlTransaction has completed; it is no longer usable.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.



Exception Details: System.InvalidOperationException: This SqlTransaction has completed; it is no longer usable.



Source Error:



An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.







Stack Trace:





[InvalidOperationException: This SqlTransaction has completed; it is no longer usable.]

System.Data.SqlClient.SqlTransaction.ZombieCheck() +831309

System.Data.SqlClient.SqlTransaction.Rollback() +88

MicroFour.StrataFrame.Data.DbDataSourceItem.TransactionEnd(String TransactionKey, Boolean IsCommit) +445

MicroFour.StrataFrame.Data.DbDataSourceItem.TransactionRollback(String TransactionKey) +9

MicroFour.StrataFrame.Data.DataLayer.TransactionRollback(String DataSourceKey, String TransactionKey) +45

MicroFour.StrataFrame.Business.BusinessLayer.TransactionRollback(String DataSourceKey, String TransactionKey) +5

Vfs.Generic.UI.Web.Strataframe.Forms.DataEntryBasePage.Save(Boolean transactional, String transactionKey) +1315

Vfs.Generic.UI.Web.ExtendedControls.MaintenanceToolbar.HandleMenuItemClick(Object source, MenuItemEventArgs e) +562

DevExpress.Web.ASPxMenu.ASPxMenuBase.OnItemClick(MenuItemEventArgs e) +107

DevExpress.Web.ASPxMenu.ASPxMenuBase.RaisePostBackEvent(String eventArgument) +325

DevExpress.Web.ASPxClasses.ASPxWebControl.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10

System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13

System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +175

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











--------------------------------------------------------------------------------



Version Information: Microsoft .NET Framework Version:2.0.50727.3053; ASP.NET Version:2.0.50727.3053



By ChanKK - 4/22/2009

Hi,

BTW, the error posted just now happen to all page that contains save function.
By ChanKK - 4/25/2009

Sorry, one more week past. Any update?



Thank you
By Trent L. Taylor - 4/27/2009

Chan,

We have not reproduced your memory leak as we had mentioned in the previous comment on this topic.  In regards to your error posted about saving...I think that at this point you may be a little "gun-shy" as this has not changed in the framework in some type.  You are more than welcome to give me steps to reproduce this, but this hasn't changed, Chan.  As I mentioned in my previous post, we cannot reproduce a memory leak nor is there an issue with the transactional saves.  You may forget that we are not only framework developers, but also use the framework in developing a major medical application.  The version to which you are saying you are receiving an error regarding transactions is pushed out into the field and we use transactions heavily in all of our transaction posting.  So I am VERY confident in this code. I think that you have a cross section of assemblies from different versions or something with your structures or SPROCs that could potentially be cuasing this.  As you well know, StrataFrame is a framework for developers which means that many times when an error occurs it has nothing to do with the framework but something within the environment or code that has been developed.  This is always a balancing act to find out exactly where an issue may be occuring.  If you can provide steps to reproduce this then we will most definitely do so.  Otherwise there is nothing I can do to help.

By ChanKK - 4/29/2009

Hi,

As mentioned in PM, the actual problem of Save transaction is "object reference is not set" during DataLayer.Save(). After some debugging, I found that if my web form contains more than one BO and I save all of them in a loop (within transaction), the 2nd BO.Save() will be failed.



It is caused by the connection and transaction object is null at the point of code as below.



'-- UpdateRow

'-- Set the connection

If Me.CanConnectDirectly Then

If QueryInfo.IsTransactional Then

loCommand.Transaction = CType(Me.Transactions(QueryInfo.TransactionKey), SqlTransaction)

loCommand.Connection = CType(Me.Transactions(QueryInfo.TransactionKey).Connection, SqlConnection)




The cause of both references are null, I suppose, is caused by this code





'-- Get a clone to avoid thread locking

loCommand = loCommand.Clone()



'-- Some code here



'-- Dispose of the cloned command

loCommand.Connection = Nothing

loCommand.Dispose()





As I see the cloned command object is assigned back to same variable. Then, the command.Connection is set to null as clean up.



What do you think? Please advice.



Thank you
By ChanKK - 4/30/2009

Hi,

After further thinking, don't feel loCommand = loCommand.Clone() can cause this problem. hmmm...
By Trent L. Taylor - 4/30/2009

Agreed.  The Clone should not cause an issue as it creates a unique instance which is then fully autonomous from the other instance.
By ChanKK - 4/30/2009

Hi,

Any hint how to troubleshoot on this?



Thank you
By Trent L. Taylor - 4/30/2009

Well, this thread is getting a bit ambiguous.  I was just commenting on your Clone comment.  In regards to the core of your issue, are you referring the SqlTransaction error?  The error, which you have already learned, is going to be specific to something that you are doing within your code.  So the questions to work through are:

  • When are you creating a transaction?
  • Is it possible for the same code to be called at the same time?
  • Are the objects in question specific to a session or the application?
  • Are you using shared data tables?
  • If you turn off transactions do your issues go away?

These are types of things that you need to be asking yourself.  Only you know your exact code and what you have done at this point.  This code is going to be related to your specific application.  So I would begin to work through these questions.

By ChanKK - 5/2/2009

Hi,

After some further testing, I think I found the root cause of the memory leak. It is actually happen if I have subscribed any BO's events at Page_Load.



As event binding will cause dangling reference to subscriber and publisher object (Web.Page and BO in this case), supposedly it shouldn't not cause any memory leak as garbage collector able to handle it. However, as SF way of web dev, BO is always be stored at session variable, it prevents GC to collect them even though is unused.



My current temporary fix is to unsubscribe all BO events at Page_Unload. It seem works (as I tested using one page). I will ask to change the rest of page and test again.



I am not sure if other SF users notice about this, but I am quite new to .NET and not really realize about this. I hope this could be mentioned at somewhere, at least help document.



Beside, some .NET expert has pointed me to this url which use another approach to prevent event-memory leak. Here is it for your reference if SF is not notice about it yet.



http://blog.codeinreview.com/post/2008/11/27/NET-EVENTS-(Part-3-A-Weak-Solution).aspx



Thank you for your previous effort, I am going to test it again and hope it could be solved. Also, I hope SF suggest/implement any better approach (weakevent for example) so that developer do not required to remember to unsubscribe BO events all the time.



Thank you very much.
By Trent L. Taylor - 5/4/2009

Glad you found a solution.  We will take this post into consideration and look at it from this perspective to see if we can reproduce. 
By ChanKK - 10/14/2010

Hi
After so many months/years of this issue solved, we found memory leak again after upgrade to SF 1.7.0.7.. I have attached the sample project, database and also snapshot of the memory profiler captured using redgate tool.

Just open and run the project, keep reload (F5) the page, you will found that memory usage keep increasing, use any memory profiler will found that some object like BOs, descriptors are not released.

Our SF dll is compiled using 1.7.0.7 source code, as we need to solve the issue convert PrimaryKey value to string manually.
We are using DevExpress 10.1.4.



Please advice. Urgent!!
By Trent L. Taylor - 10/15/2010

Chan,

For whatever this is worth, we have not changed anything in this regard.  I am willing to bet that you have an old assembly someplace, or something within your environment has changed.  I will look at this, but I find it strange that this would just suddenly "reappear."
By Trent L. Taylor - 10/15/2010

Chan,

I am confused as to what your application is trying to do.  You supplied the nwind.mdb database, but your connection string is an SqlDataSourceItem (not Access), so I am not sure what database I am supposed to connect to.  Since your test app is wired to look at an SQL database I am assuming that you have an MDF somewhere that I should be connecting to.  I will look through all of the attached files again, but please advise.  Thank you.
By Trent L. Taylor - 10/15/2010

Just to update you, I noticed that the nwind.mdb table name was Employees (with an "s") and your BO was mapped without the "s".  Changed this and it still did not work.  45 minutes into it and still can't make your sample work.  Sorry.  I am going to wait until I receive more details about what database I am supposed to connect to.

One other thing I noticed is that this is not a StrataFrame wired web application.  Clearly you can do this, but you may have Session issues, etc. since we wire things up through the ApplicationBasePage and the global.asax.  I noticed that you created your own TestBasePage.cs....this is really not related to the issue, just an observation.

Awaiting further instruction.  Thanks.
By ChanKK - 10/15/2010

Hi,
I will double check and send you correct DB later.

One other thing I noticed is that this is not a StrataFrame wired web application.  Clearly you can do this, but you may have Session issues, etc. since we wire things up through the ApplicationBasePage and the global.asax.  I noticed that you created your own TestBasePage.cs....this is really not related to the issue, just an observation.

I am following SF way to wire global.asax, just that I use this to do so that I can have common "BaseApplication"

<%@ Application Inherits="Vfs.Testing.UI.Web.TestApplication" Language="C#" %>

Regarding ApplicationBasePage, I am using seperate BasePage for each web form. It reason is we don't have to share same BOs among all forms. The reasons are:
1. We don't want to use unique BO property in each form for same BO. i.e. EmployeesBO in form A might contains difference data. If we use single ApplicationBasePage, the data might be "corrupted" by other form.

2. Also, we might have thread-safe issue need to take into account.

Please advice if any issue with this design.

Regarding SF dll, I have check the SF dll version in bin folder (deployment folder) and it shown 1.7.0.7. We compiled it via source code. Anyway, I will attach the SF dll together in next future

Thank you
By Trent L. Taylor - 10/17/2010

Chan,

I think that your logic is sound, it was just an observation.  At this point I think that you have the web development with SF down anyway, so I wasn't concerned, just curious Smile
By ChanKK - 10/17/2010

Trent L. Taylor (10/17/2010)
Chan,

I think that your logic is sound, it was just an observation.  At this point I think that you have the web development with SF down anyway, so I wasn't concerned, just curious Smile


Any better way of doing this? Currently we are concerning about the memory usage since each page hold its own data/BO and not been released until session expired. It might cause memory insufficient issue.

Beside, I have redo and attach new project, it connects to Northwind employees table. Just launch default.aspx, and keep refresh it (F5). I also included the SF dll that I am using.

Please find the snapshot below I captured from memory profiler

http://farm5.static.flickr.com/4084/5091831291_1f031789c1_b.jpg




http://farm5.static.flickr.com/4131/5092430900_070b868869_b.jpg
By ChanKK - 10/19/2010

Hi
Just would like to know if SF team able to reproduce it.

Thank you
By Ivan George Borges - 10/20/2010

Hi Chan.

Currently we are concerning about the memory usage since each page hold its own data/BO and not been released until session expired. It might cause memory insufficient issue.


Were you able to hit the insufficient memory error?

I have downloaded your sample and will alocate some time to have a look at it as soon as possible. Will let you know of my tests here once I have something.

Cheers.
By ChanKK - 10/20/2010

Ivan George Borges (10/20/2010)
Were you able to hit the insufficient memory error?


Hi,
Beside of memory leak, we found that it utilize huge memory. We are in progress to add filtering and limit # of records to be retrieved from every query.
By Ivan George Borges - 10/20/2010

Got it. That is always a best practice on a disconnected scenario.
By ChanKK - 10/20/2010

Hi
Could you reproduce the memory leak issue?

I need solution ASAP.

Thank you
By Ivan George Borges - 10/21/2010

Sorry Chan, not yet.
By ChanKK - 10/25/2010

Hi
any update?
Sorry it is show stopper for us. 
By ChanKK - 10/27/2010

I still haven't get any update n this. It has been 1 week. I know you might be busy and not only handle one issue. However, I think it is very critical. You might looking on this as well, but at least you update me you are looking on it instead of just "silent" mode. It is very difficult for me to convince my management to continue renew subscription by this kind of support provided.

Hope you understand. Thank you
By Ivan George Borges - 10/28/2010

Hi Chan.

I follow this forum extensively and I am sure you have always had the best support available, no matter your license status.

As for testing your sample, there is a third party product being used that happens not to be on my toolset, so this is not as straight forward as we all would like it to be. By the way, have you contact the other vendor to check if they have ideas about it? Also, have you tested your solution on a plain windows web control?

Moreover, I have asked you if you were able to reach an error message testing your website and I never got an answer.
By ChanKK - 10/28/2010

Ivan George Borges (10/28/2010)
Hi Chan.

I follow this forum extensively and I am sure you have always had the best support available, no matter your license status.

As for testing your sample, there is a third party product being used that happens not to be on my toolset, so this is not as straight forward as we all would like it to be. By the way, have you contact the other vendor to check if they have ideas about it? Also, have you tested your solution on a plain windows web control?

Moreover, I have asked you if you were able to reach an error message testing your website and I never got an answer.


Thank you reply.

No, I didn't test on plain web control because I think it is meaningless. No matter plain web control is working or not, it doesn't help me at all. It could be DevExpress / Strataframe issue. However, from users perspective, since SF stated it support devexpress then I would expect SF to make it compatible (at least any workaround or communicate with Devexpress, but not us). In fact, I also don't know the internal code how could I answer some technical question from them? I used to posted other question to DevExpress (without post to SF forum) and they are willing help to troubleshoot and tell me the "story" why not working with SF and etc.

But for this issue, it happened with same symptom before and I suspected should be same.

Anyway, I will post this issue to devexpress today.

Sorry, shall you explain more on "reach an error message testing" ??
If you need a project that able to show you memory leak, I think I did post it in my previous post already.

By Ivan George Borges - 10/29/2010

Hi Chan.

Well, are you getting a SystemOutOfMemory exception?

Good to know you are checking with the DevEx guys. Let us know of the outcome.

Cheers.
By ChanKK - 10/29/2010

Ivan George Borges (10/29/2010)
Hi Chan.


Well, are you getting a SystemOutOfMemory exception?

Good to know you are checking with the DevEx guys. Let us know of the outcome.

Cheers.

Yes, I hit systemOutOfMemory exception.

Below is the reply from DevExpress team

It's a well known problem, which is not caused by our components. Please refer to the following issue to find more information about it:Memory leak in Server mode.
By Ivan George Borges - 10/29/2010

Thanks for posting, Chan.

I will reproduce here just in case we loose that link in the future.

From the DevEx team:

"Processed (Won't fix) by DevExpress Team at 8/16/2006 6:42:49 PM

Sorry for the delay in responding. It has taken us some time to perform additional tests. As we can see, the problem is caused by the ASP.NET itself ... it does work in such a manner. To understand this, we have created a similar sample with the standard DataGrid and we do see the same results - the memory usage increases on every postback. Though it is lower in comparison to the ASPxGrid, it is well explained by the fact that our Grid has a more complex server-side structure and creates more objects on the server."
By ChanKK - 10/30/2010

SF team will still investigate on how to avoid this .. right?
By Ivan George Borges - 10/30/2010

Yeah, although DevEx clearly states it is an ASP.NET characteristic and that they won't fix it, I know for a fact that this is on the SF developer's team table to study and see if it is possible to find a workaround.
By ChanKK - 11/9/2010

any news?

Thank you
By Ivan George Borges - 11/10/2010

Not yet, Chan.
By ChanKK - 11/30/2010

Hi
still no luck?
I would like to know if SF team able to reproduce it or not ?

Anyway, I have escalate this issue to Microsoft, by utilize my company MS Incident support token.

Thank you
By ChanKK - 12/1/2010

Hi,
Here is the reply from Microsoft. Hope it give some clue to SF team

I tried to reproduce the problemlocally and did some debugging. I am updating you with the current findings:

 

The problem should be related tohow EmployeesBO object is used.

 

1st time access todefault.aspx

=======================

 

10 EmployeesBO objects werecreated.

 

 

   Address        MT     Size  Gen

0x0628ddfc0x01b8d4c0      604    1BusinessObjectLibrary1.EmployeesBO

0x062e082c0x01b8d4c0      604    1BusinessObjectLibrary1.EmployeesBO

0x062e11600x01b8d4c0      604    1BusinessObjectLibrary1.EmployeesBO

0x062e19580x01b8d4c0      604    1BusinessObjectLibrary1.EmployeesBO

0x062e21500x01b8d4c0      604    1BusinessObjectLibrary1.EmployeesBO

0x062e29480x01b8d4c0      604    1 BusinessObjectLibrary1.EmployeesBO

0x062e31400x01b8d4c0      604    1BusinessObjectLibrary1.EmployeesBO

0x062e39380x01b8d4c0      604    1BusinessObjectLibrary1.EmployeesBO

0x062e41300x01b8d4c0      604    1BusinessObjectLibrary1.EmployeesBO

0x062e4ae4 0x01b8d4c0     604    1 BusinessObjectLibrary1.EmployeesBO

 

I checked the relationship ofthese objects. 0x0628ddfc seems to be a root object and be added to the sessionstate.

 

The other 9 EmployeesBO objectswere referenced by 0x0628ddfc.  (I have 9 records in the Employees table of NorthWinddatabase)

 

For example:

 

DOMAIN(011FF9F0):HANDLE(Strong):ee11fc:Root: 0e2701a4(System.AppDomain)->

 02272b40(System.ResolveEventHandler)->

 0227215c(System.Web.Compilation.BuildManager)->

  02272d44(System.Web.Compilation.MemoryBuildResultCache)->

 0e28bcf0(System.Web.Caching.CacheMultiple)->

 0e28bd08(System.Object[])->

 0e28ea10(System.Web.Caching.CacheSingle)->

 0e28eb24(System.Web.Caching.CacheExpires)->

 0e28eb44(System.Object[])->

 0e28ec94(System.Web.Caching.ExpiresBucket)->

 0a2b5fb4(System.Web.Caching.ExpiresPage[])->

 0a2b6038(System.Web.Caching.ExpiresEntry[])->

 022f5a04(System.Web.Caching.CacheEntry)->

 022f59d4(System.Web.SessionState.InProcSessionState)->

  0a285c28(System.Web.SessionState.SessionStateItemCollection)->

 0a285e3c(System.Collections.Hashtable)->

 0a285e74(System.Collections.Hashtable+bucket[])->

 0628e740(System.Collections.Specialized.NameObjectCollectionBase+NameObjectEntry)->

  0628ddfc(BusinessObjectLibrary1.EmployeesBO)->

  0a329b50(System.Data.DataTable)->

  0e393eec(System.Data.DataView)->

  0e398424(System.ComponentModel.ListChangedEventHandler)->

  0e395d48(System.Object[])->

  0e3960e8(System.ComponentModel.ListChangedEventHandler)->

  062e05e4(MicroFour.StrataFrame.Business.BusinessBindingSource)->

  062e0660(System.Collections.Generic.Dictionary`2[[System.Int32,mscorlib],[MicroFour.StrataFrame.Business.BusinessLayer, MicroFour StrataFrameBusiness]])->

  062e49c8(System.Collections.Generic.Dictionary`2+Entry[[System.Int32,mscorlib],[MicroFour.StrataFrame.Business.BusinessLayer, MicroFour StrataFrameBusiness]][])->

  062e4ae4(BusinessObjectLibrary1.EmployeesBO)

 

It seems that the object0x062e4ae4 was referenced by 0628ddfc through DataTable object and eventhandlers. (highlighted)

 

2nd  time accessto default.aspx

=======================

9 new objects were created andthey were all referenced by the root object 0x0628ddfc which was in turn referenced bysession state.

 

0x0e3985a00x01b8d4c0      604    0BusinessObjectLibrary1.EmployeesBO

0x0e398f540x01b8d4c0      604    0BusinessObjectLibrary1.EmployeesBO

0x0e3997900x01b8d4c0      604    0BusinessObjectLibrary1.EmployeesBO

0x0e399fcc0x01b8d4c0      604    0BusinessObjectLibrary1.EmployeesBO

0x0e39a8ac0x01b8d4c0      604    0BusinessObjectLibrary1.EmployeesBO

0x0e39b1180x01b8d4c0      604    0BusinessObjectLibrary1.EmployeesBO

0x0e39b954 0x01b8d4c0     604    0 BusinessObjectLibrary1.EmployeesBO

0x0e39c2200x01b8d4c0      604    0BusinessObjectLibrary1.EmployeesBO

0x0e39cbc80x01b8d4c0      604    0BusinessObjectLibrary1.EmployeesBO

 

 

DOMAIN(011FF9F0):HANDLE(Strong):ee11fc:Root: 0e2701a4(System.AppDomain)->

 02272b40(System.ResolveEventHandler)->

 0227215c(System.Web.Compilation.BuildManager)->

 02272d44(System.Web.Compilation.MemoryBuildResultCache)->

 0e28bcf0(System.Web.Caching.CacheMultiple)->

 0e28bd08(System.Object[])->

  0e28ea10(System.Web.Caching.CacheSingle)->

 0e28eb24(System.Web.Caching.CacheExpires)->

 0e28eb44(System.Object[])->

 0e28ec94(System.Web.Caching.ExpiresBucket)->

 0a2b5fb4(System.Web.Caching.ExpiresPage[])->

 0a2b6038(System.Web.Caching.ExpiresEntry[])->

  022f5a04(System.Web.Caching.CacheEntry)->

 022f59d4(System.Web.SessionState.InProcSessionState)->

 0a285c28(System.Web.SessionState.SessionStateItemCollection)->

 0a285e3c(System.Collections.Hashtable)->

 0a285e74(System.Collections.Hashtable+bucket[])->

 0628e740(System.Collections.Specialized.NameObjectCollectionBase+NameObjectEntry)->

  0628ddfc(BusinessObjectLibrary1.EmployeesBO)->

 0a329b50(System.Data.DataTable)->

 0e393eec(System.Data.DataView)->

 0e398424(System.ComponentModel.ListChangedEventHandler)->

 0e395d48(System.Object[])->

 0e398404(System.ComponentModel.ListChangedEventHandler)->

 0e39822c(MicroFour.StrataFrame.Business.BusinessBindingSource)->

 0e398270(System.Collections.Generic.Dictionary`2[[System.Int32,mscorlib],[MicroFour.StrataFrame.Business.BusinessLayer, MicroFour StrataFrameBusiness]])->

 0e39ca78(System.Collections.Generic.Dictionary`2+Entry[[System.Int32,mscorlib],[MicroFour.StrataFrame.Business.BusinessLayer, MicroFour StrataFrameBusiness]][])->

  0e399fcc(BusinessObjectLibrary1.EmployeesBO)

 

 

In addition, I found theseobjects were referenced byMicroFour.StrataFrame.Business.BusinessLayer.SharedDataTableCollection.

 

DOMAIN(011FF9F0):HANDLE(Pinned):fe11f4:Root: 12277ad8(System.Object[])->

  0628e08c(MicroFour.StrataFrame.Business.BusinessLayer+SharedDataTableCollection)->

 0628e0a0(System.Collections.Generic.Dictionary`2[[System.String,mscorlib],[System.Collections.Generic.List`1[[MicroFour.StrataFrame.Business.BusinessLayer,MicroFour StrataFrame Business]], mscorlib]])->

 062e1104(System.Collections.Generic.Dictionary`2+Entry[[System.String,mscorlib],[System.Collections.Generic.List`1[[MicroFour.StrataFrame.Business.BusinessLayer,MicroFour StrataFrame Business]], mscorlib]][])->

  062e10d4(System.Collections.Generic.List`1[[MicroFour.StrataFrame.Business.BusinessLayer,MicroFour StrataFrame Business]])->

 062e4928(System.Object[])->

 062e082c(BusinessObjectLibrary1.EmployeesBO)

 

 

Recommendation

==============

If I use multiple users(multiple sessions) to do load test, the memory usage increases quickly becausethere will be multiple root EmployeesBO objects which are stored in sessionstate.

 

Please do involve yourdevelopers of these components (e.g. MicroFour.StrataFrame.Business.BusinessBindingSource,BusinessObjectLibrary1.EmployeesBO,MicroFour.StrataFrame.Business.BusinessLayer.SharedDataTableCollection) tocheck the logic relationship of these components.

 

If they want to keep a copy ofthe data, please make sure only keep one copy.

By Ivan George Borges - 12/1/2010

Thanks Chan.

Although this has been concluded as an ASP.NET issue, your message has been forwarded to be checked.
By ChanKK - 12/2/2010

Ivan George Borges (12/2/2010)
Thanks Chan.

Although this has been concluded as an ASP.NET issue, your message has been forwarded to be checked.


Hi
The log is sent by Microsoft, I doubt it is ASP.NET issue or not. But from the reply, it seem Microsoft NEVER mentioned it is ASP.NET issue.
By Ivan George Borges - 12/2/2010

Nope, this is what your DevEx support guys said, as you have posted before.

For a starter, although you already stated it would be pointless, a good test (or workaround) would be to put the DevEx control aside and create your own user control, populate it and see if it would work fine.

But it is on the list, and will be checked if there is anything that can be done.
By ChanKK - 12/21/2010

any updates??
By Ivan George Borges - 12/21/2010

No Chan, not yet.
By ChanKK - 12/22/2010

hi
any timeline?
may i know no update mean what?
haven't test, don't know the root cause yet, don't know solution yet or no plan to fix it?

My customers just can't keep waiting endless. We need at least a workaround.

This issue has been reported for more than a month, hope SF team understand our difficulty as well.

Thank you
By Ivan George Borges - 12/22/2010

may i know no update mean what?haven't test, don't know the root cause yet, don't know solution yet or no plan to fix it?


None of the alternatives. It just means I haven't been updated on it.

My customers just can't keep waiting endless. We need at least a workaround.


That is understandable, but I need to remind you, as I have done before, that this has been considered an ASP.NET issue by your other third party grid vendor, which even openly stated that it wouldn't fix it, and what our developing team will try is to find you a workaround, if possible. All I know is that it is on their list.

This issue has been reported for more than a month, hope SF team understand our difficulty as well.


Yep, we all do and appreciate your business, and will try to help you as soon as possible, I am sure about it.

Cheers.
By Trent L. Taylor - 1/10/2011

I thought that I close out this post as email was used to work through this process. 

There were a lot of posts here and so it is just a matter of time before people look back here for a solution.  In short, we have gone through this thoroughly and sufficiently proven that StrataFrame doesn't have a memory leak.  There was, however, a valid issue that this customer was dealing with in regards to a memory leak and a DevExpress grid.  Below are two memory profiles, one with a DevExpress grid and another with a standard GridView:

DevExpress Web Grid Memory Profile
http://forum.strataframe.net/Uploads/Images/2c06d1b4-7887-451e-b52a-78db.png
(Download the attachment for a better look)

The DevExpress web grid does have many objects still in memory as part of this process.  In most cases, this would probably not cause an issue as the "leak" was negligible.  But if you are retrieving a very large data set and dealing with many records, then this could be an issue.  Also, the more records that are in the data set, the DevExpress.Web.ASPxClasses (Display Classes) that will be created, thus increasing memory size.  This not not a fault of DevExpress, but more of an attribute to the complexity and functionality of their control.

GridView Memory Profile
http://forum.strataframe.net/Uploads/Images/be40a39e-b788-4de8-88d0-2e29.png
(Download the attachment for a better look)

In this example, the same test was performed.  A new property called AutoDisposeHandlersAndObjects was added to the WebBusinessBindingSource that allows the control to clean up automatically.  Though this can be used on the GridView and several others that have been tested (i.e. Infragistics), this will not work with the DevExpress Web Grid as the way that they enumerate the underlying data source prevents certain disposals from taking place, though the instance never grew past 1 BBS in our testing.  That said, you can see that in the GridView test, there are no BBS references remaining and the environment is much cleaner.  This is not a criticism of DevExpress web grid by any means, just an observation, as the GridView doesn't have the "pre-built" logic the DevExpress grid does.  But the BBS can be released as part of the process.

Closing
In closing, we are not saying that there is a bug in the DevExpress Web Grid, just noting some possible issues that you may run into during development.  If there were a bug, it would be in ASP.NET most likely anyway.  If nothing else, there could be some philosophical differences here in dealing with large data sets within a grid and/or how to enumerate the underlying data source.  DevExpress has many great tools and products and we highly recommend them, but like any development cycle, each project should be evaluated to see if a particular control will meet the needs for specific intents and purpose.  So this is just to make you aware of any possible issues that may be encountered when using a StrataFrame BBS and a DevExress Web Grid.
By ChanKK - 3/15/2011

Hi
After so many discussion, we are in the progress to change our application to limit # of records to be retrieve and also added search feature to all listing page. 
However, now we are facing memory leak issue in DevExpress XtraReport (ASP.NET) also. We are using WBBS to bind our BO to report. It only contains few records. When I keep refresh the report, I see the BO (datasource) instance keep increasing. From ANTS profiler, it is referenced by SharedDataTable therefore unable to be released.

My developer is in the progress to prepare sample project.
By Trent L. Taylor - 3/16/2011

We will look at your project, Chan.  I would be very surprised at this point if there was in fact a memory leak.  We have hundreds of customers that use both the XtraReports and the Dev Grid.  But there can always be a certain property or environment that causes a particular issue.  So we can take a look and go from there.  But from the sound of it, you still have not heeded my advice on creating a custom control.  This is a bit disappointing, though, because it seems like you have a very unique and custom environment and you are trying to squeeze a 3rd party control to fit you very specific and custom needs which I think is part of your problem.
By ChanKK - 3/16/2011

Trent L. Taylor (3/16/2011)
We will look at your project, Chan.  I would be very surprised at this point if there was in fact a memory leak.  We have hundreds of customers that use both the XtraReports and the Dev Grid.  But there can always be a certain property or environment that causes a particular issue.  So we can take a look and go from there.  But from the sound of it, you still have not heeded my advice on creating a custom control.  This is a bit disappointing, though, because it seems like you have a very unique and custom environment and you are trying to squeeze a 3rd party control to fit you very specific and custom needs which I think is part of your problem.


Hi,
My company is really willing to do so, but we lack of experience on this at this moment. Beside, we are busy to solve some other issues before this. That is the reason we would like to have SF team to send us built custom control so that we can use it straight away or at least some reference.
By ChanKK - 3/16/2011

BTW, I don't think we have very unique environment as I just use simple BO with XtraReport. Also, for the reporting tool, we never do any custom code to it as well. Just a simple listing. Anyway will upload the sample as soonest.
By ChanKK - 3/16/2011

Hi
I have posted my sample project

Testing DB
Sample project


I also attached screenshot of ANTS profiler which shown the instances of BO keep increasing for each refresh.

Screenshot


Please advice ASAP

Thank you
By Trent L. Taylor - 3/17/2011

Well, like I said, we have so many people that use XtraReport and DevExpress and don't experience these issues.  So there is some underlying design issue or environmental issue that you guys seem to always be up against.  But at any rate, we will look at the sample that you post to see if there is something framework related.
By ChanKK - 3/17/2011

Hi
I totally agree with what you mentioned, "How come only we hit this issue?!!?!?!" Just like last time, only we hit thread-safe issue, transaction issue and etc. At last only found that 

1. Thread-safe - bug
2. Transaction - Only happen if using ad-hoc CRUD for, working fine for SP
3. Memory leak (1st reported) - DevExpress and SF integration issue

My mgmt also asking since so many developers are using SF and DevExpress UI why don't they hit issue as us? I also don't know how to answer.

Anyway, if you think is our environment issue, please post me question, or I can arrange remote access for you. We can do anything for you, we just need solution!!! Memory leak issue has brought our company into very very worst market position at this moment.

Much appreciate for your help
By ChanKK - 3/21/2011

Hi
May I know any update?
My customer keep calling us, and they expect this issue to be solved before 25/3/2011.
By Trent L. Taylor - 3/22/2011

We are going to look at it one more time, but like all previous examples that you have shown, the problem only seems to persist with the DevExpress grid.  If the same thing is done with an Infragistics grid or the standard web grid, it works perfectly. 

Looking back in our notes, this is the same thing that was mentioned on the previous 2 samples that were sent in.  It looks the disposal does not fire through the DevExpress web grid...and ironically, this was due to an issue that you turned in after a point release of DevExpress over a year ago.

We are not through testing, but these are the current results.
By ChanKK - 3/22/2011

Hi
Thank you for your efforts.
Really need your help!!

Thank you
By ChanKK - 3/23/2011

Hi
May I know when should the GridView to dispose the WBBS's data? I asked DevExpress, with below reply:

The datasource should not be disposed of during the pagelife cycle. The grid might use the datasource object even in the PreRenderevent handler. And if you dispose of the datasource somewhere in the code, thegrid will not be able to use it anymore.
By Trent L. Taylor - 3/23/2011

I did say dispose, but I should have said release a handler.  We are trying to determine what they are hanging on to.  For the record, we are not going to get into a back and forth with DevExpress with you as the middle-man.  We are still evaluating their grid to see if we can do anything that doesn't "break" all other environments.  This is what happened the last time we made this accommodation for you.
By ChanKK - 3/23/2011

OK.
Anyway, hope you found the solutions soon. 

BTW, as I informed earlier, I sent the sample project to Microsoft support, they feedback that BO.List_Changed event is not released. You can refer back my previous messages. HTH
By Trent L. Taylor - 3/23/2011

Which makes sense as this is a part of the IEnumerable interface to which the external controls bound to the WBBS or BBS can control the navigation of the object.  However, it is their responsibility to add and remove the handler.  The WBBS doesn't create the handler for the grid, the grid creates the handler.  Thus the crux of the problem.  We are going to see if there is a way for us, through reflection, to cut the ties to the control.  But at the moment the control is hanging on to the WBBS, not the other way around.
By ChanKK - 3/23/2011

Hi
I hope I didn't defocus you, I need solution on memory leak which happen to ASP.NET XtraReport as well. I am not sure if the same root cause as ASPxGridView.
By Trent L. Taylor - 3/23/2011

Same issue, same problem.  When a handler is not released, the object cannot be disposed.  Thus you get a memory leak.  That is why it is so important for all controls to work within the confines of the framework and interfaces used therein.  In this example, the DevExpress controls that use attach to the IEnumerable interface are not releasing the handlers as expected.  Thus, a memory leak.  Again, we will see if there is something we can do to accommodate all 3rd party controls.  But here is one thing that I have already proven.  We can use a Custom BBS and an XtraReport with no memory leak whatsoever.  This is a very common control and combination of tools used by SF users.  Some of our largest users also use the XtraReports within massive applications.  And if they were experiencing memory leaks like you have described, there would be mass chaos. The DevExpress web grid is another story, however, as most people take a different approach, as I have mentioned in previous dealings with your current issue.

Regardless, I would love nothing more than to find a solution on our side so we can get this behind us.
By Peter Jones - 3/23/2011

Hi,

We use SF / DX combination for everything and have no problems but we don't use web forms. Anyway that's not why I'm posting. I just wanted to say that I think SF support is simply outstanding. Even though we don't use it much it is really nice to know such support depth is there.

Cheers, Peter
By ChanKK - 3/23/2011

I am totally agree that SF really helpful. 
However, my customer and management want solution. Without that, everything is nothing for them.

Once again, very much appreciated on kindly support
By ChanKK - 3/29/2011

any update?
Thank you
By ChanKK - 4/14/2011

Hi
I have debug and have temporary fix for this issue. I changed code in SF as below. What I tried to do is expose the instance of BusinessBindingSource used by WBBSEnumerator, then on page_unload, dispose it. At this moment, it doesn't solve my issue. I am in the progress to do more detailed testing to see if any impact to data editing inside gridview. Hope it helps SF team to speed up the permanent fix. Thank you

Public Structure WBBSEnumerator
            Implements IEnumerator
            Implements IEnumerable

#Region " Constructors "

            ''' <summary>
            ''' Initializes a new instance of this Enumerator structure.
            ''' </summary>
            ''' <param name="bo"></param>
            ''' <param name="start"></param>
            ''' <param name="count"></param>
            ''' <remarks></remarks>
            Public Sub New(ByVal bo As BusinessLayer, ByVal start As Integer, ByVal count As Integer)
                Me._BBS = bo.GetEnumerable(True, False)
                Me._BusinessObjectEnumerator = Me._BBS.GetEnumerator()
                Me._CurrentCount = 0
                Me._MaxCount = count
                Me._StartIndex = start
            End Sub



''' More code

            Public ReadOnly Property BBS() As BusinessBindingSource
                Get

                    Return CType(Me._BBS, BusinessBindingSource)
                End Get
            End Property
        End Structure