VB App hanging in memory

  • Thread starter Thread starter SStory
  • Start date Start date
S

SStory

Have noticed that my app sometimes hangs in memory.

It is a multithreaded app with a main thread and a worker thread but I call
something to spin it down on quiting.

Any ideas as to why this would be happening?

Anyone else had this?

Thanks,

Shane
 
* "SStory said:
Have noticed that my app sometimes hangs in memory.

It is a multithreaded app with a main thread and a worker thread but I call
something to spin it down on quiting.

Any ideas as to why this would be happening?

No.

Post code.
 
ok.

I have fixed in in a sort of "guess" way.

I was using the paradigm given by the Wrox Professional VB.NET book to
manage my thread.

According to them I go this basic strategy in a workerclass for my thread

Public Sub Cancel()
_bIsCancelled = True
_paused.Set()
End Sub

Public Sub SpinUp()
Dim start As New ThreadStart(AddressOf Me.Start)
_thread = New Thread(start)
_thread.Name = "My thread name"
_thread.Start()
End Sub

spindown only had
Cancel()
_thread.Join
_thread=nothing
This according to the Wrox book.
For me it kept hanging the app in memory. Like the join was waiting forever.
I don't know why. So I decided to try to timeout in 1 second and kill it
using .Abort.

Is this a bad solution? Is there something better? Code with changes
below:

Public Sub SpinDown()
Cancel()
_thread.Join(1000) 'waits for thread to finish
_thread.Abort() 'shane changed to timeout and then abort; was hanging in
memory. 2-18-04
_thread = Nothing 'set thread to nothing
End Sub

Thanks for your help.

Shane
 
Back
Top