diff options
| author | _ov4 <ov4@ov4.org> | 2026-10-22 15:08:51 +0000 |
|---|---|---|
| committer | _ov4 <ov4@ov4.org> | 2026-10-22 15:21:11 +0000 |
| commit | 8b6ba7222d9990bc19e355eabcf046a7ea773545 (patch) | |
| tree | adf98eaaebd455168806cdb6f5dbebb11fb3dd89 /AGENTS/PITFALLS | |
| parent | fa83b7df5a0711bf5f4a5162cc33b0a4123a53c7 (diff) | |
fix(arrays): free array buffers when their scope ends
Register every array as a stack object so its buffer is freed on scope
end, re-DECLARE, RETURN and unwinding; run the element-destroy loop only
for types that need destruction.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Diffstat (limited to 'AGENTS/PITFALLS')
| -rw-r--r-- | AGENTS/PITFALLS/core-language.md | 2 | ||||
| -rw-r--r-- | AGENTS/PITFALLS/exceptions-and-c-interop.md | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/AGENTS/PITFALLS/core-language.md b/AGENTS/PITFALLS/core-language.md index 60fbd11..0ddba05 100644 --- a/AGENTS/PITFALLS/core-language.md +++ b/AGENTS/PITFALLS/core-language.md @@ -13,7 +13,7 @@ source, most also by compiling and running test programs. - **Arrays cross function boundaries only as parameters.** `ArrayTable` is scoped per function, so referencing another function's array fails cleanly as "Undeclared array". Whole arrays pass as `ARRAY OF T` / `ARRAY[l:u,...] OF T` - parameters (BYVAL copies the entire buffer and never frees it); a whole-array + parameters (BYVAL copies the entire buffer; the copy is freed when the callee ends); a whole-array argument against a scalar parameter is still a compile error. FUNCTIONs cannot RETURN arrays. A whole-array variable is also rejected as an operand or as a value of its element type. diff --git a/AGENTS/PITFALLS/exceptions-and-c-interop.md b/AGENTS/PITFALLS/exceptions-and-c-interop.md index 104be41..b057d18 100644 --- a/AGENTS/PITFALLS/exceptions-and-c-interop.md +++ b/AGENTS/PITFALLS/exceptions-and-c-interop.md @@ -12,8 +12,8 @@ Part of the [pitfalls index](../PITFALLS.md). - Uncaught exceptions also print the generic termination message and return 1. - Native compilation links the C++ runtime automatically; manually linking emitted `.ll` files must use LLVM 23's `clang++` (`clang++-23` on Debian/Ubuntu). -- Owned STRING values follow class cleanup during unwinding; raw array buffers are - not freed and files are not automatically closed. +- Owned STRING values follow class cleanup during unwinding; array buffers are freed + and files are not automatically closed. - Check the native nightly job results when changing platform-specific code (CI coverage: [ARCH/BUILD.md](../ARCH/BUILD.md)). |
