D
David Hanson
All,
I have an application which a has a main Form which child forms are opened
from, then once the user has finished using the opened form it is closed and
disposed. All of the application worked fine until I started to plug some
webservices into my code. What I found was that the applications memory
usuage started to rocket, the application slowed down and things went pants.
I started to look at the new fuctions which included webservices. The
example below shows one of these fucntions.
Public Function UploadData() As Boolean
UploadData = False
Dim sPath As String = BlogPath
Dim oData As New DataSet
Dim oRows As DataRow()
With oData
.ReadXml(sPath)
oRows = .Tables(0).Select("Uploaded = false") '
.Tables(0).Rows.Clear()
.Tables(0).Rows.Add(oRows)
End With
Dim oWs As New CodeBehind.ApplicationLogic
oWs.Credentials = GetCredentials()
If oWs.UpdateData(oData, AppMod.OUser.UserID.ToString) <> "" Then
Return False
End If
oData = Nothing
oWs = Nothing
UploadData = True
End Function
Then debugging through my app I started to monitor how much memory was used.
What I found was this:
Function Started at 93844 Bytes
..ReadXml(sPath) line raised memory to 143032 Bytes
oWs.UpdateData line raised memory to 235752 Bytes.
The problem I have here is that I can never seem to release the memory used
by calling the webservice method. If i go on to call other webmethods in
other functions the memory is rapidly eaten up. I tried many things to
resolve this like GC.Collect and disposing forms but none of them seem to
work. I had a single instace of the webservice objedct held in an an
application module but the same problem occurs?
Can anyone help me on this? This is running on CF for the Smartphone by the
way....
Regards
Dave Hanson
I have an application which a has a main Form which child forms are opened
from, then once the user has finished using the opened form it is closed and
disposed. All of the application worked fine until I started to plug some
webservices into my code. What I found was that the applications memory
usuage started to rocket, the application slowed down and things went pants.
I started to look at the new fuctions which included webservices. The
example below shows one of these fucntions.
Public Function UploadData() As Boolean
UploadData = False
Dim sPath As String = BlogPath
Dim oData As New DataSet
Dim oRows As DataRow()
With oData
.ReadXml(sPath)
oRows = .Tables(0).Select("Uploaded = false") '
.Tables(0).Rows.Clear()
.Tables(0).Rows.Add(oRows)
End With
Dim oWs As New CodeBehind.ApplicationLogic
oWs.Credentials = GetCredentials()
If oWs.UpdateData(oData, AppMod.OUser.UserID.ToString) <> "" Then
Return False
End If
oData = Nothing
oWs = Nothing
UploadData = True
End Function
Then debugging through my app I started to monitor how much memory was used.
What I found was this:
Function Started at 93844 Bytes
..ReadXml(sPath) line raised memory to 143032 Bytes
oWs.UpdateData line raised memory to 235752 Bytes.
The problem I have here is that I can never seem to release the memory used
by calling the webservice method. If i go on to call other webmethods in
other functions the memory is rapidly eaten up. I tried many things to
resolve this like GC.Collect and disposing forms but none of them seem to
work. I had a single instace of the webservice objedct held in an an
application module but the same problem occurs?
Can anyone help me on this? This is running on CF for the Smartphone by the
way....
Regards
Dave Hanson