Releasing memory properly when using a BBS


Author
Message
Andria Jensen
Andria Jensen
Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)
Group: Forum Members
Posts: 336, Visits: 497
I have numerous DevExpress grids and tree list controls in my application which I am binding to BOs using BusinessBindingSource controls.  I have recently discovered that DevExpress does a very poor job of releasing memory and disposing of their own object properly.  I have a lot of memory leaks coming up in my app because of this.  Now, to the part where SF is involved...I have been running memory profilers which are showing that the grids, trees, etc are still linked to the BBS which is preventing them from being disposed of properly at garbage collection. 

My theory is that the BBS is somehow dynamically creating columns in the grid or tree at runtime, but not manually disposing of them when it's unloaded.  DevExpress basically expects you to dispose of everything, so I'm wondering if somehow the BBS is still linked to the DevExpress controls and preventing them from being released from memory correctly.  Is this a possibility?

I can open and close a test form I have created without filling the BO that is linked to the BBS, and it releases all memory correctly when the form is closed.  If I fill the BO when opening the form, it will not release all memory once closed.  Any ideas here?

Replies
Andria Jensen
Andria Jensen
Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)Advanced StrataFrame User (600 reputation)
Group: Forum Members
Posts: 336, Visits: 497
But if it is the dispose of a BO, it is in the designer code which is regenerated with each partial.  Is this where you are referring to?

<System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
  If (disposing AndAlso (Not (Me.components) Is Nothing)) Then
    Me.components.Dispose()
 
End If

  MyBase.Dispose(disposing)

End Sub

 


Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
From your post, I thought you were referring to a BBS instead of the BO.  Technically, in this example, they objects should dispose of themselves since the BOs implement IDisposable.  However, .NET isn't always good about managing this. 

In this particular example, I rarely manually dispose of the object.  And we have this type of code all over the place.  We have hundreds of instances where we have this type of code and it gets cleaned up.  When I was referring to in code, I was talking about as a local like this:

Dim lc As New MyBo()

'-- Do your stuff here

lc.Dispose()

However, it never hurts to manually Dispose() of objects if they are getting "hung up" due to the environment in which they are being used.  So in your case, I would manually Dispose() to see if memory gets cleaned up.  In this case, I would palce all of my logic in the BaseBO in which all of my BOs inherit.  Then this code would be implemented in a single location versus having to be re-written for each BO.  Also, using this approach will not be an issue with the partial class.

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Threaded View
Threaded View
Andria Jensen - 17 Years Ago
Trent L. Taylor - 17 Years Ago
Andria Jensen - 17 Years Ago
Trent L. Taylor - 17 Years Ago
Andria Jensen - 17 Years Ago
Trent L. Taylor - 17 Years Ago
Andria Jensen - 17 Years Ago
Trent L. Taylor - 17 Years Ago
Andria Jensen - 17 Years Ago
Trent L. Taylor - 17 Years Ago
Andria Jensen - 17 Years Ago
Trent L. Taylor - 17 Years Ago
Andria Jensen - 17 Years Ago
             No problem, glad to help :)
Trent L. Taylor - 17 Years Ago
Andria Jensen - 17 Years Ago
Andria Jensen - 17 Years Ago
Trent L. Taylor - 17 Years Ago
Purnell W Glenn - 11 Years Ago
Trent L. Taylor - 11 Years Ago
Danny Doobay - 12 Years Ago

Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search