From 4feeb94b12a2529f14f9bd7847f7253d704990af Mon Sep 17 00:00:00 2001 From: Holger Vogt Date: Mon, 30 Mar 2026 16:03:19 +0200 Subject: [PATCH] Improve error message, make fprintf independent from OS --- src/frontend/outitf.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/frontend/outitf.c b/src/frontend/outitf.c index 56883b04d..586813947 100644 --- a/src/frontend/outitf.c +++ b/src/frontend/outitf.c @@ -556,16 +556,19 @@ OUTpD_memory(runDesc *run, IFvalue *refValue, IFvalue *valuePtr) { int i, n = run->numData; + #ifndef __APPLE__ if (!cp_getvar("no_mem_check", CP_BOOL, NULL, 0)) { /* Estimate the required memory */ - size_t memrequ = (size_t)n * vlength2delta(0) * sizeof(double); + int timesteps = vlength2delta(0); + size_t memrequ = (size_t)n * timesteps * sizeof(double); size_t memavail = getAvailableMemorySize(); if (memrequ > memavail) { - fprintf(stderr, "\nError: memory required (%Id Bytes)\n" - " is more than memory available (%Id Bytes)!\n", - memrequ, memavail); + fprintf(stderr, "\nError: memory required (%zu Bytes), made of\n" + " %d nodes and approximately %d time steps,\n" + " is more than the memory available (%zu Bytes)!\n", + memrequ, n, timesteps, memavail); fprintf(stderr, "Setting the output memory is not possible.\n"); controlled_exit(1); }