Process hanging around in memory

Jun 7, 2012 at 3:52 PM

Greetings. Thank you for an excellent piece of software! Just what I needed to help get a project done, and I can see a lot of further potential for it.

The component works well in terms of the functionality I need but there is one annoying issue that much tinkering has not solved.

As soon as I begin to use the component, i.e. add a printer to the monitor list, then when I subsequently close my program, its process refuses to die gracefully.

The UI vanishes as expected but the oprogram is still in Task Manager's process list. I can kill it there, but obviously something is not right. And in the IDE running in debug mode, closing the form does not return to editing mode. I have to force it to stop debugging.

I have this code in the form closing event handler:

Private Sub frmMain_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
 Catch ex As Exception
  MsgBox("Error disposing of PrinterMonitorComponent : " + ex.Message, MsgBoxStyle.Exclamation, "Close-down error")
 End Try
End Sub 

Elsewhere I explicitly remove montitored printers from the monitor list, as not doing so caused an exception. Now I don't get exceptions, just stuck in memory.

We have quite a complex printing environment here but I can reproduce the problem at home in a fairly clean VM in a fairly trivial network.

I don't get the problem if I quit just before adding a printer to the monitor.

In both cases it's VB Express 2005 (.Net 2) running on plain old 32-bit XP.

Any ideas?

I tried to get the trace working to look for clues but didn't manage to obtain a log file.


Jun 12, 2012 at 4:46 PM
Edited Jun 12, 2012 at 4:48 PM

Most likely the thread created to monitor the printer is not being disposed. 

Is this the latest version?  I think there is a method on PrinterMonitorComponent to explicitly stop monitoring :

Disconnect - Stops all printer monitoring

Jun 14, 2012 at 5:19 PM

Thanks very much for taking the time to reply.

Just before calling .Dispose() I tried ...

Me.PrinterMonitorComponent.SpoolMonitoringDisabled = True

I still get the stuck process problem.

DLL version is

I tried other versions while trying to fix this but tomorrow I will move to to be sure.