ChanKK
|
|
Group: Forum Members
Posts: 190,
Visits: 1.3K
|
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.
|
|
|
Trent Taylor
|
|
Group: StrataFrame Developers
Posts: 6.6K,
Visits: 6.9K
|
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.
|
|
|
ChanKK
|
|
Group: Forum Members
Posts: 190,
Visits: 1.3K
|
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!!
|
|
|
Trent Taylor
|
|
Group: StrataFrame Developers
Posts: 6.6K,
Visits: 6.9K
|
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."
|
|
|
Trent Taylor
|
|
Group: StrataFrame Developers
Posts: 6.6K,
Visits: 6.9K
|
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.
|
|
|
Trent Taylor
|
|
Group: StrataFrame Developers
Posts: 6.6K,
Visits: 6.9K
|
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.
|
|
|
ChanKK
|
|
Group: Forum Members
Posts: 190,
Visits: 1.3K
|
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
|
|
|
Trent Taylor
|
|
Group: StrataFrame Developers
Posts: 6.6K,
Visits: 6.9K
|
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
|
|
|
ChanKK
|
|
Group: Forum Members
Posts: 190,
Visits: 1.3K
|
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 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
|
|
|
ChanKK
|
|
Group: Forum Members
Posts: 190,
Visits: 1.3K
|
Hi Just would like to know if SF team able to reproduce it. Thank you
|
|
|