推荐链接:
总结——》【Java】
总结——》【Mysql】
总结——》【Spring】
总结——》【SpringBoot】
总结——》【MyBatis、MyBatis-Plus】
1、代码
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List;
@RestController
public class TestController {
List<Object> list = new ArrayList<>();
@GetMapping("/test")
public String test() {
while (true) {
list.add(new Object());
}
}
}
2、配置
-Xmx20M -Xms20M
3、运行
http://localhost:8080/test
4、结果
Exception in thread "http-nio-8080-exec-2" java.lang.OutOfMemoryError: GC overhead limit exceeded