From d35c210d9c67bd2f9bad5a69cdafcf5e4dcced4f Mon Sep 17 00:00:00 2001 From: chendaofei <857448963@qq.com> Date: Tue, 29 Apr 2025 16:46:42 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AE=97=E6=B3=95=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/njcn/algorithm/ExecutionCenter.java | 29 +++++++++---------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/ExecutionCenter.java b/algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/ExecutionCenter.java index c77a991..ce9176c 100644 --- a/algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/ExecutionCenter.java +++ b/algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/ExecutionCenter.java @@ -91,22 +91,21 @@ public class ExecutionCenter extends BaseController { * @date 2023/11/7 14:44 */ private void dealResponse(CalculatedParam calculatedParam, LiteflowResponse liteflowResponse, String methodDescribe) { + Runtime runtime = Runtime.getRuntime(); + // 获取 JVM 最大可用内存(以字节为单位) + long maxMemory = runtime.maxMemory(); + // 获取 JVM 当前已分配的内存(以字节为单位) + long totalMemory = runtime.totalMemory(); + // 获取 JVM 当前空闲内存(以字节为单位) + long freeMemory = runtime.freeMemory(); + // 计算已使用的内存 + long usedMemory = totalMemory - freeMemory; + + System.out.println("最大可用内存: " + maxMemory / (1024 * 1024) + " MB"); + System.out.println("当前已分配的内存: " + totalMemory / (1024 * 1024) + " MB"); + System.out.println("当前空闲内存: " + freeMemory / (1024 * 1024) + " MB"); + System.out.println("已使用的内存: " + usedMemory / (1024 * 1024) + " MB"); if (liteflowResponse.isSuccess()) { - Runtime runtime = Runtime.getRuntime(); - // 获取 JVM 最大可用内存(以字节为单位) - long maxMemory = runtime.maxMemory(); - // 获取 JVM 当前已分配的内存(以字节为单位) - long totalMemory = runtime.totalMemory(); - // 获取 JVM 当前空闲内存(以字节为单位) - long freeMemory = runtime.freeMemory(); - // 计算已使用的内存 - long usedMemory = totalMemory - freeMemory; - - System.out.println("最大可用内存: " + maxMemory / (1024 * 1024) + " MB"); - System.out.println("当前已分配的内存: " + totalMemory / (1024 * 1024) + " MB"); - System.out.println("当前空闲内存: " + freeMemory / (1024 * 1024) + " MB"); - System.out.println("已使用的内存: " + usedMemory / (1024 * 1024) + " MB"); - // 获取执行步骤列表 long allTime = 0; Map> executeSteps = liteflowResponse.getExecuteSteps();