Can I "destroy" a class

surfuric

Member
Licensed User
Longtime User
I have written a class which has a Webview in it. (Needs WebView to be able to log into a password protected website using javascript. Figured out how with Warwound's help.)

Because it has a Webview in it, I cannot declare the class in the Process_Globals section of my service. So I am forced in a regular Sub to do something like:

Dim readReports as GetReports
readReports.Initialize(...)
readReports.PullFromWeb(Main.the_user,Main.the_password)

It works. But I am leaking memory. In a service, I call the class once an hour. Each time (checking the memory used) I can see memory being allocated and never returned even with forcing garbage collection.

So my hope is that there is some way of "destroying" the definition of the class once it runs to completion. This would also get rid of the WebView definition within the class as well (I hope).

This is my last step in my project. I sincerely hope there is a solution. Any help will be sincerely appreciated.

Thanks,
Craig
 

surfuric

Member
Licensed User
Longtime User
@margret, I am embarrased to say I did not think of setting it to Null. I actually had already tried readReports = "" and when the compiler complained I thought it could not be done. Simple, but good lesson.

@Erel, good idea to force service to run more often. When I start the Dalvik Debug Monitor and watch the VM Heap's Allocated memory, it does stay close to constant. I even stopped forcing garbage collection as I know that is not recommended. (Hey, I was desperate!) Thanks for the advice.
 
Last edited:
Upvote 0
Top