Click here to Skip to main content
11,582,850 members (72,223 online)

.NET Framework

 
QuestionRe: Visual Studio Online or Express? Pin
Eddy Vluggen11-Aug-14 7:44
professionalEddy Vluggen11-Aug-14 7:44 
AnswerRe: Visual Studio Online or Express? Pin
adamhill912-Aug-14 1:44
memberadamhill912-Aug-14 1:44 
GeneralRe: Visual Studio Online or Express? Pin
Eddy Vluggen12-Aug-14 5:15
professionalEddy Vluggen12-Aug-14 5:15 
GeneralRe: Visual Studio Online or Express? Pin
adamhill912-Aug-14 5:49
memberadamhill912-Aug-14 5:49 
GeneralRe: Visual Studio Online or Express? Pin
Eddy Vluggen12-Aug-14 7:24
professionalEddy Vluggen12-Aug-14 7:24 
GeneralRe: Visual Studio Online or Express? Pin
adamhill913-Aug-14 0:21
memberadamhill913-Aug-14 0:21 
GeneralRe: Visual Studio Online or Express? Pin
Richard MacCutchan12-Aug-14 20:55
protectorRichard MacCutchan12-Aug-14 20:55 
GeneralRe: Visual Studio Online or Express? Pin
adamhill913-Aug-14 0:22
memberadamhill913-Aug-14 0:22 
AnswerRe: Visual Studio Online or Express? Pin
PIEBALDconsult11-Aug-14 8:01
memberPIEBALDconsult11-Aug-14 8:01 
AnswerRe: Visual Studio Online or Express? Pin
robcaron12-Aug-14 7:12
memberrobcaron12-Aug-14 7:12 
GeneralRe: Visual Studio Online or Express? Pin
adamhill913-Aug-14 0:26
memberadamhill913-Aug-14 0:26 
AnswerRe: Visual Studio Online or Express? Pin
thatraja13-Aug-14 2:30
protectorthatraja13-Aug-14 2:30 
AnswerRe: Visual Studio Online or Express? Pin
sankarsan parida27-Aug-14 20:48
professionalsankarsan parida27-Aug-14 20:48 
QuestionRequesting help chasing a .net memory leak Pin
Member 858457310-Aug-14 7:46
memberMember 858457310-Aug-14 7:46 
Hey, all. Been after this one a few days and it's driving me crazy. I've refactored several times based on information I've found on the net (i.e. event handlers, circular references, etc) but I'm just not getting anywhere.

What I have is a generic hierarchical data structure that is distributed over a LAN via TCP. The concept was that I wanted to be able to share variables between applications over networked machines using a common protocol. The problem is whenever I run the thing and watch the process with Process Explorer, I can see a steady increase in Physical Memory usage (WS Private). I have a test application that accesses the nodes in the tree several times a second and can watch it climb (app consumes about 50 MB of memory when idle and then climbs at about 300 K per second). By playing around and commenting/uncommenting various blocks of code, I've narrowed the problem down to whenever the nodes in the tree are being accessed. At first I was certain that the problem was in the implementation of my object hierarchy because I had circular references (children had a reference to their parents) and figured that was messing up GC. But then I redid the implementation to remove that relationship and it's still happening. This is really driving me nuts.

Here's some (abridged) code. I can provide more if needed but don't want this to turn into a novel outright.

First, the object hierarchy:

Starts with a MustInherit base class: Node
Node is just a basic node in the tree. Everything that lives in the tree must inherit from this class.

ContainerNode:
Inherits from Node. It has an internal sortable dynamic list of Node instances and includes methods necessary to traverse that list (HasChildren, etc).

Cluster:
Inherits from ContainerNode. A Cluster is a collection of related nodes. A Cluster is the top most object in the tree. A Cluster contains a list of Groups and DataNodes.

Group:
Inherits from ContainerNode. A Group is a collection of related nodes within a Cluster. A Group contains more Groups and DataNodes.

DataNode:
Inherits from Node. A DataNode is a variable "leaf" item on the tree. It can be any kind of basic data type (string, integer, etc, etc).

The whole tree is accessed through a class called Agent. The Agent provides the methods necessary to add and remove nodes and set their values. It also sends changes in the tree out to the network and receives requests from connected clients over the network to modify the tree.

Nodes on the tree each have a signature, which looks pretty similar to a directory path in Linux (/Cluster/Group/Group/DataNode). I don't deal with relative paths.

So after a bunch of screwing around I've traced the problem down to whenever I access a node on the tree. Up at the App level, I have the following:

If (m_Service.NodeValue(Path.ToString & "/ParamID") = ParamType) Then
    Return m_Service.NodeValue(Path.ToString & "/AutoCalc")
End If

This corresponds to a property in a class called Service, which exposes the Agent and everything else to client applications (this whole thing is packed into a class library).

 
Public Property NodeValue(ByVal Path As String) As Object
    Get
        Return m_Agent.NodeValue(Path)
    End Get
    Set(ByVal value As Object)
        m_Agent.NodeValue(Path) = value
    End Set
End Property

Within Agent, there is the following:
Public Property NodeValue(ByVal Path As String) As Object
    Get
        Try
            Return DirectCast(Me.GetNode(Path), Tree.DataNode).Value
        Catch ex As Exception
            Return Nothing
        End Try
    End Get
    Set(ByVal value As Object)
        Try
            Dim N As DataNode = DirectCast(Me.GetNode(Path), Tree.DataNode)
            If (N IsNot Nothing) Then
                If (N.NodeVal <> value) Then
                    N.NodeVal = value
                    If (Me.SuppressEvents = False) Then
                        OnValueChanged(N.Signature.ToString, value)
                    End If
                End If
            End If
        Catch ex As Exception
        End Try
    End Set
End Property

GetNode does this:
Public Function GetNode(ByVal Path As String) As Node
    If (m_Nodes.IsEmpty) Then
        Return Nothing
    End If
 
    If (String.IsNullOrEmpty(Path)) Then Return Nothing
 
    If (Path.Equals("/")) Then
        m_Nodes.First()
        Return m_Nodes.Current
    End If
 
    If (Path.Substring(0, 1).Equals("/")) Then
        Return AbsolutePath(Path)
    End If
 
    Return Nothing
End Function
 
Private Function AbsolutePath(ByVal Path As String) As Node
    Path = Path.TrimStart("/")
    Dim Data() As String = Path.Split("/")
 
    If (Data.Length > 0) Then
        Dim Index As Integer = m_Nodes.GetItemIndex(New SearchNode(Data(0)))
        AbsolutePath = m_Nodes.AtIndex(Index)
 
        If ((AbsolutePath IsNot Nothing) And (Data.Length > 1)) Then
            For X As Integer = 1 To Data.Length - 1
                If (AbsolutePath IsNot Nothing) Then
                    If (AbsolutePath.HasChildren) Then
                        AbsolutePath = DirectCast(AbsolutePath, ContainerNode).Child(Data(X))
                    Else
                        Return Nothing
                    End If
                Else
                    Return Nothing
                End If
            Next
        End If
 
        Return AbsolutePath
    End If
 
    Return Nothing
End Function

Now, through testing, I've found that calling GetNode is enough to make the memory leak occur. That means no events firing and nothing else special, just a simple GetNode, which returns the Node instance back to the caller.

It seems to me that this should be something that the language should be able to handle, so I'm either missing something fundamental or I'm nowhere near as knowledgeable as I'd like to believe.

I greatly appreciate any help, hints, or insight you can provide.

Thanks much.
AnswerRe: Requesting help chasing a .net memory leak Pin
Eddy Vluggen11-Aug-14 7:51
professionalEddy Vluggen11-Aug-14 7:51 
GeneralRe: Requesting help chasing a .net memory leak Pin
Joshua Gayou11-Aug-14 10:48
memberJoshua Gayou11-Aug-14 10:48 
AnswerRe: Requesting help chasing a .net memory leak Pin
Joshua Gayou11-Aug-14 13:08
memberJoshua Gayou11-Aug-14 13:08 
QuestionCS0029: Cannot implicitly convert type 'System.DateTime' to 'var' Pin
demoninside98-Aug-14 20:50
memberdemoninside98-Aug-14 20:50 
AnswerRe: CS0029: Cannot implicitly convert type 'System.DateTime' to 'var' Pin
PIEBALDconsult8-Aug-14 20:56
memberPIEBALDconsult8-Aug-14 20:56 
GeneralRe: CS0029: Cannot implicitly convert type 'System.DateTime' to 'var' Pin
demoninside98-Aug-14 21:13
memberdemoninside98-Aug-14 21:13 
GeneralRe: CS0029: Cannot implicitly convert type 'System.DateTime' to 'var' Pin
PIEBALDconsult9-Aug-14 5:24
memberPIEBALDconsult9-Aug-14 5:24 
GeneralRe: CS0029: Cannot implicitly convert type 'System.DateTime' to 'var' Pin
Dave Kreskowiak9-Aug-14 6:25
mvpDave Kreskowiak9-Aug-14 6:25 
GeneralRe: CS0029: Cannot implicitly convert type 'System.DateTime' to 'var' Pin
demoninside98-Aug-14 21:22
memberdemoninside98-Aug-14 21:22 
GeneralRe: CS0029: Cannot implicitly convert type 'System.DateTime' to 'var' Pin
PIEBALDconsult9-Aug-14 5:23
memberPIEBALDconsult9-Aug-14 5:23 
AnswerRe: CS0029: Cannot implicitly convert type 'System.DateTime' to 'var' Pin
Richard MacCutchan8-Aug-14 22:39
protectorRichard MacCutchan8-Aug-14 22:39 
GeneralRe: CS0029: Cannot implicitly convert type 'System.DateTime' to 'var' Pin
demoninside99-Aug-14 0:35
memberdemoninside99-Aug-14 0:35 
QuestionRetrieve information from UDL file Pin
Ashfaque Hussain4-Aug-14 19:23
memberAshfaque Hussain4-Aug-14 19:23 
AnswerRe: Retrieve information from UDL file Pin
Eddy Vluggen5-Aug-14 2:37
professionalEddy Vluggen5-Aug-14 2:37 
QuestionControls resize to init after changing language Pin
ChriSSi0034-Aug-14 1:36
memberChriSSi0034-Aug-14 1:36 
AnswerRe: Control resize to init after changing language Pin
Eddy Vluggen4-Aug-14 2:00
professionalEddy Vluggen4-Aug-14 2:00 
AnswerRe: Control resize to init after changing language Pin
Bernhard Hiller4-Aug-14 20:49
professionalBernhard Hiller4-Aug-14 20:49 
GeneralRe: Control resize to init after changing language Pin
ChriSSi0034-Aug-14 21:26
memberChriSSi0034-Aug-14 21:26 
GeneralRe: Control resize to init after changing language Pin
Bernhard Hiller4-Aug-14 23:38
professionalBernhard Hiller4-Aug-14 23:38 
GeneralRe: Control resize to init after changing language Pin
ChriSSi0035-Aug-14 0:49
memberChriSSi0035-Aug-14 0:49 
Question.net memory leaks Pin
Bret Stern3-Aug-14 16:10
memberBret Stern3-Aug-14 16:10 
AnswerRe: .net memory leaks Pin
MarkLTX3-Aug-14 16:40
memberMarkLTX3-Aug-14 16:40 
GeneralRe: .net memory leaks Pin
Bret Stern3-Aug-14 18:46
memberBret Stern3-Aug-14 18:46 
AnswerRe: .net memory leaks Pin
Dave Kreskowiak3-Aug-14 17:26
mvpDave Kreskowiak3-Aug-14 17:26 
GeneralRe: .net memory leaks Pin
Bret Stern3-Aug-14 18:44
memberBret Stern3-Aug-14 18:44 
QuestionHow to get all the visited url lists from any browser programmatically using c# in .Net 2.0 framework Pin
Member 105012112-Aug-14 2:11
memberMember 105012112-Aug-14 2:11 
AnswerRe: How to get all the visited url lists from any browser programmatically using c# in .Net 2.0 framework Pin
Eddy Vluggen2-Aug-14 12:25
professionalEddy Vluggen2-Aug-14 12:25 
AnswerRe: How to get all the visited url lists from any browser programmatically using c# in .Net 2.0 framework Pin
Dave Kreskowiak3-Aug-14 17:17
mvpDave Kreskowiak3-Aug-14 17:17 
AnswerRe: How to get all the visited url lists from any browser programmatically using c# in .Net 2.0 framework Pin
Bernhard Hiller3-Aug-14 20:48
professionalBernhard Hiller3-Aug-14 20:48 
GeneralRe: How to get all the visited url lists from any browser programmatically using c# in .Net 2.0 framework Pin
Nathan Minier6-Aug-14 10:24
memberNathan Minier6-Aug-14 10:24 
Questionsherdian controls : license not found Pin
zuber ahmed2-Aug-14 1:40
memberzuber ahmed2-Aug-14 1:40 
AnswerRe: sherdian controls : license not found Pin
Richard MacCutchan2-Aug-14 2:51
protectorRichard MacCutchan2-Aug-14 2:51 
Questionhi Pin
TNKumar31-Jul-14 19:42
memberTNKumar31-Jul-14 19:42 
QuestionRe: hi Pin
Richard MacCutchan31-Jul-14 20:30
protectorRichard MacCutchan31-Jul-14 20:30 
AnswerRe: hi Pin
TNKumar31-Jul-14 23:55
memberTNKumar31-Jul-14 23:55 
GeneralRe: hi Pin
Richard MacCutchan31-Jul-14 23:59
protectorRichard MacCutchan31-Jul-14 23:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web03 | 2.8.150603.1 | Last Updated 6 Jul 2015
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid