Does this give scope for a memory leak?

I have a class, myClass, which has a property:

localRead as localreadDelegate

with the class having a Delegate definition with the appropriate parameters.

Now, when I create an instance of myClass, I do this:

Var  myclassInst as myClass
myclassInst = new myClass
myclassInst.localRead = AddressOf mySocket.localRead

Now this question is this: when the instance myclassInst done with, goes out of scope and is destroyed, do I need to do anything about the AddressOf? Such as setting it to Nil first? If not, why is that different for AddHandler?

I’m looking at this because I recently added code so that a debug version of my app reports on all the object types it has and how many of each there are, and it looks like the delegate count is inching up as time passes.

Since you are encapsulating the Delegate as a property of class localreadDelegate, if this is the cause of your Delegate count increase you should also see a corresponding increase in the number of that class hanging around. Is that the case?

Use WeakAddressOf if this is an instance method that the delegate is pointing to.

Doesn’t appear to be, no.