• Welcome, Guest. Please login.
 

When calling slitening from visual studio 2015 seems to have a leak memory.

Started by JonasHdez, August 17, 2016, 02:42:21 pm

Previous topic - Next topic

JonasHdez

I am using VB.net 2015 and I am able to communicate with my sqlite database in remote mode. but every time I call the function GetField seems to allocate a lot of memory and I am not able to release it.

I try to use  slsCloseSet(0) but seems not to do anything.

this function from Visual Studio GC.Collect() seems to help a litle bit but still memory continue increasing as much as I use the GetField  function.

Any Idea about this problem.

Here is my code in VB.net

by the way excellent product overall.



    Public Function GetDataTable(ByVal Statement As String, ByVal rsMode As String, Optional ByRef bNothing As Boolean = False) As DataTable

        If isConnected = False Then
            Throw New Exception("no connection, connect first")
        End If
        Dim dt As New DataTable
        Dim ColCount As Integer
        Dim as1 As Long
        Dim swert() As String
        Dim zaehler As Integer
        Dim sFieldName As String
        Dim sFieldValue As String
        'slsSetProcessMods("E0T5")
        rsMode = ""
        as1 = slsSel(Statement, 0, rsMode)
        ColCount = Convert.ToInt32(ColumnCount(0))
        ReDim swert(ColCount - 1)
        Do While slsGetRow(0, "") > 0
            zaehler += 1
            For i As Integer = 1 To ColCount
                sFieldName = slsGetColumnName(i, 0).ToString
                sFieldValue = GetField(sFieldName)
                If zaehler = 1 Then
                    dt.Columns.Add(sFieldName)
                End If

                If sFieldValue = "" Then
                    swert(i - 1) = ""
                Else
                    swert(i - 1) = sFieldValue
                End If
            Next
            dt.Rows.Add(swert)
        Loop
        slsCloseSet(0)
        GC.Collect()
        Return dt
    End Function

End Class


JonasHdez

Thanks for your answer, I run the suggested and code and seems to have the same results. Looks like the problem is inside the sqlitening dll that is not properly deleting the memory after the last row.

Any other advise

JonasHdez

Using sFieldValue = slsF(i, 0) help a lot but still leaking and the memory keep incresing,

GetField  is an interna function that call slsFN in my program. but SLSF seems to be working much better.

I will try the msgbox suggestion and let you know. Thanks for all your support.


This is what I have so far in VB.net 2015.

    Public Function GetDataTable2(ByVal Statement As String, ByVal rsMode As String, Optional ByRef bNothing As Boolean = False) As DataTable

        If isConnected = False Then
            Throw New Exception("no connection, connect first")
        End If
        Dim dt As New DataTable
        Dim ColCount As Integer
        Dim as1 As Long
        Dim swert() As String
        Dim sFieldName As String
        Dim sFieldValue As String
        rsMode = ""
        as1 = slsSel(Statement)
        ColCount = Convert.ToInt32(ColumnCount(0))
        ReDim swert(ColCount - 1)

        'Add Columns
        For i As Integer = 1 To ColCount
            sFieldName = slsGetColumnName(i, 0).ToString
            dt.Columns.Add(sFieldName)
        Next
        'Add Rows
        Do While slsGetRow(0, "")
            For i As Integer = 1 To ColCount
                sFieldValue = slsF(i, 0)
                'sFieldValue = "123456789"
                If sFieldValue = "" Then
                    swert(i - 1) = ""
                Else
                    swert(i - 1) = sFieldValue
                End If
            Next
            dt.Rows.Add(swert)
        Loop
        Return dt
    End Function