The log that caused the memory leak is as follows:
E STRICTMODE:A Resource was acquired on attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks.
E StrictMode:java.lang.Throwable:Explicit Termination method ' end ' not called
......
E strictmode:at com.android.server.connectivity.NetworkMonitor.isCaptivePortalExt (networkmonitor.java:1026)
Networkmonitor.java The original code is as follows, according to the intent of this code, is to get the request, and then through a broadcast called Android.net.conn.NETWORK_CONDITIONS_MEASURED to send out. The key value is Extra_request_timestamp_ms and Extra_response_timestamp_ms (if any).
Why is a memory leak caused?
I found that the problem occurs when I use a weak network environment, such as the use of China Mobile GPRS internet this time will cause a longer request time, just if there are other applications (such as Google Music, etc.) also frequently verify the network connectivity, And the small storage of the machine will cause memory resource leakage.
The following changes are followed:
Get the InputStream object and then close it at the appropriate time, in fact is.close () can be put into
Httpresponsecode = Urlconnection.getresponsecode () before.
[Android Network validity detection] Networkmonitor code causes a memory leak