解决okhttp内存泄漏问题
This commit is contained in:
@@ -53,6 +53,13 @@ public class HttpUtils {
|
|||||||
@Override
|
@Override
|
||||||
public void onResponse(Call call, Response response) throws IOException {
|
public void onResponse(Call call, Response response) throws IOException {
|
||||||
LOG.info("POST to {} success with response: {}", url, response.body());
|
LOG.info("POST to {} success with response: {}", url, response.body());
|
||||||
|
try {
|
||||||
|
if (response.body() != null) {
|
||||||
|
response.body().close();
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user