Hello all,

I am having an issue with a Remoting application where the server is a VB.NET Winforms application and the clients are ASP.NET pages running on a CE.NET 5.0 mobile device - obviously IIS (v6.0) is the real client.  IIS and Winform application run on the same server.

The issue I have is related to a known bug in this KB article -  When a page is often refreshed, IE on the mobile devices produces the error "Program memory is critically low. You must select one task to terminate (unsaved changes will be lost), or increase the amount of program memory, if available". I have an ASPX page that refreshes every 10 seconds or so to display status data retrieved from the Winforms application via a remoted object.  After some time, the memory leak causes the previous message to be displayed and IE has to be closed or the device rebooted.

I am not dynamically allocating any event handlers in the web code as stated in the KB article, but I believe that the issue is related to the instance of the remoted object that I am creating.  I am trying to find a way to release the resources that this object is consuming, but am not finding a good way to do it. I basically want to dispose the object and connection in the Page.Unload method.

Here is the code for the Winforms app that is creating the Singleton remoted object, which works fine.

Winforms Server


    'Create object we will remote. It implements the IPresses interface.

    cPress = New RemotePress

    Dim httpChannel As New Channels.Http.HttpChannel(23456)

    ChannelServices.RegisterChannel(httpChannel, False)

    'Remote the object and get an ObjRef

    rPressRef = RemotingServices.Marshal(cPress, "RemotePress", GetType(IPresses))

Catch ex As System.Net.Sockets.SocketException

    'Display an error message...

    'Log error message...

Catch ex As Exception

    'Log error message...

End Try

Next, the code for the ASPX page that connects to the remoted object and refreshes every 10 seconds.

ASPX Client


    'create our instance of the remote object

      sUrl = ""

oPresses = CType(Activator.GetObject(GetType(IPresses), sUrl), IPresses)


    'check to see if any alarms, display message

    If oPresses.PressesInAlarm.Count > 0 Then

'display an alarm message¡­


'Create an <embed> tag that will play a wav file if an alarm exists

Dim badSound As New WebControl(HtmlTextWriterTag.Embed)

badSound.Attributes.Add("src", "buzzer.wav")

badSound.Style("width") = "0px;"

badSound.Style("height") = "0px;"



badSound = Nothing

    End If

Catch ex As Exception

'display an error message¡­


      oPresses = Nothing

End Try

Other than setting the remoted object proxy to Nothing in the Unload method of the page, I am not sure what to do to properly release the resources so I can get rid of the IE on CE.NET error. Any help and advice is appreciated.  Is there a better way I can go about this



Re: Smart Devices General Releasing client (ASP.NET) resources after connecting to Winforms SAO

George Kremenliev - MSFT

This question should be asked either to the ASP.NET forum or to the CE IE forum. If my suggestion doesn't help I will move the thread there.

Have you tries to set oPresses to Nothing (instead of badSound which is not the remoting object)

Re: Smart Devices General Releasing client (ASP.NET) resources after connecting to Winforms SAO


Yes, I do set the object to Nothing after I am done with it, forgot to post that line.

Sorry, was not sure where to post this, but figured that what I am trying to do is release the resources related to a remoted object, so this was the forum I chose. If it belongs in a different thread, please do move it.


Re: Smart Devices General Releasing client (ASP.NET) resources after connecting to Winforms SAO


I ended up working around this issue by eliminating the need to refresh the page. Instead of running the code to connect to a remoted object when the page loads, I am using a ScriptCallback to do it. When the page loads, JavaScript runs and calls-back ASP.NET code that runs on the server. The ASP.NET code only returns something to the client-side JavaScript if there is a message that needs displayed. The page is never refreshed, but rather modified by JavaScript.