BlueSocket icon indicating copy to clipboard operation
BlueSocket copied to clipboard

Deinit

Open SwatGuard opened this issue 6 years ago • 2 comments

When does deinit get called ? I'm using BlueSocket on a Mac running as a server and on a iPhone as a client. The server runs some apple scripts when the client sends some keywords. I noticed that I get memory leaks every time scripts are being executed. I noticed that deinit is never called. Any advice is much appreciated.

SwatGuard avatar Feb 08 '19 15:02 SwatGuard

Are you using queues? In this case they might be hanging on to the parent object with its reference to your Socket. You will have to signal the queue’s closure to end its listing loop and return so there are no more references owning the Socket object.

See #167 for sort-of the opposite issue I had: the parent object going away and the queue crashing.

JanX2 avatar Mar 10 '19 17:03 JanX2

I suspect this is due to the fact that the delegate is holding a strong reference:

public var delegate: SSLServiceDelegate? = nil {

I think this should be a weak var and the SSLServiceDelegate modified to be a class protocol.

ggal625 avatar Apr 09 '20 14:04 ggal625