From 03bcdf14bfb8a5560ab698ac7c2b6cb75cfe84d5 Mon Sep 17 00:00:00 2001
From: Olivier BICHLER <olivier.bichler@cea.fr>
Date: Wed, 15 Jan 2025 10:13:25 +0100
Subject: [PATCH] Fix excess size

---
 src/scheduler/Scheduler.cpp | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/scheduler/Scheduler.cpp b/src/scheduler/Scheduler.cpp
index ac73b8264..0e8cba07e 100644
--- a/src/scheduler/Scheduler.cpp
+++ b/src/scheduler/Scheduler.cpp
@@ -738,6 +738,13 @@ Aidge::MemoryManager Aidge::Scheduler::generateMemoryAutoConcat(bool incProducer
                             concatOffset += parentSize;
                         }
                     }
+
+                    // Size in reallocate() is counted from the offset, not from 0,
+                    // meaning the offset must be substracted to obtain the correct
+                    // total size without excess.
+                    if (concatOffset > 0) {
+                        concatSize -= concatOffset;
+                    }
                 }
 
                 // MemoryPlane to (re)use
-- 
GitLab