开启十个线程,每个线程都会去查询500W的数据。 @Test void testThread() throws InterruptedException { int size = 10; CountDownLatch countDownLatch = new CountDownLatch(size); for (int i = 0; i { testPage(); countDownLatch.countDown(); }); } countDownLatch.await(); } @Test void testPage(){ //查询出表中总记录数 Long total = orderMapper.selectCount(null); //每次分页读取的结果数 int fetchSize = 100000; // 分页优化参数,上次查询的最大ID int lastMaxId = 0; for (int i = 0; i orderLambdaQueryWrapper = new LambdaQueryWrapper(); orderLambdaQueryWrapper.gt(Order::getOrderId, lastMaxId); List records = orderMapper.selectPage(new Page(1, fetchSize), orderLambdaQueryWrapper).getRecords(); records.stream().forEach(System.out::println); //获取本次最大的Id lastMaxId = records.get(records.size() - 1).getOrderId(); } } 单独一个线程,堆内存占用500M。  十个线程,堆内存占用最高也不过1400MB,为什么会这样呢?这些内存占用居然不会叠加的吗? 