代码中使⽤RestTemplate下载⼤⽂件,发现会OOM,代码如下:
RestTemplate restTemplate = new RestTemplate();
// 会OOM
ResponseEntity<byte[]> entity = ForEntity("localhost:8088/1.jar", byte[].class);
log.String());
报错信息如下:
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
at java.io.ByteArrayOutputStream.<init>(ByteArrayOutputStream.java:77)
at org.adInternal(ByteArrayHttpMessageConverter.java:57) at org.adInternal(ByteArrayHttpMes
sageConverter.java:39) at org.ad(AbstractHttpMessageConverter.java:199)大文件发送
at org.springframework.web.actData(HttpMessageConverterExtractor.java:114)
发布评论