Android-tcp-server-and-client
Android-tcp-server-and-client copied to clipboard
memory leak
I have encountered a memory problem. Each time the connection is attempted, if it fails, there is a memory increment of 512KB that is never released. I tried various methods: cancel (true) in the AsyncTask when an exception is triggered in socketexception set tcpClient to null call System.gc () call TCPCommunicator.removeAllListerners () call TCPCommunicator.closeStreams () on different occasions in doInBackground SocketTimeoutException UnknownHostException IOException but every attempt has failed and memory continues to increase. Is there a way to release the class and clean the memory?
UPDATE: I tried to call Thread.currentThread.interrupt() but without luck.