A new bot thread is created every round via createThread/joinThread. When thread N dies, its ORC allocator is destroyed, but module-level seq/string globals still reference its heap blocks. Thread N+1 touching those globals causes SIGSEGV in prepareSeqAddUninit/rawDealloc.
Current workarounds use fixed-size arrays with silent ceilings:
Event queue: 256 events/tick
Team messages: 16/tick
Stdout/stderr: 4096 bytes/tick
SVG graphics: 16384 bytes/tick
Solution
Replace thread-per-round with a single persistent bot thread that lives for the process lifetime. Between rounds it blocks on a channel waiting for the next round-start signal. This keeps the allocator alive, eliminating all fixed-array workarounds.
## Problem
A new bot thread is created every round via `createThread`/`joinThread`. When thread N dies, its ORC allocator is destroyed, but module-level `seq`/`string` globals still reference its heap blocks. Thread N+1 touching those globals causes SIGSEGV in `prepareSeqAddUninit`/`rawDealloc`.
Current workarounds use fixed-size arrays with silent ceilings:
- Event queue: 256 events/tick
- Team messages: 16/tick
- Stdout/stderr: 4096 bytes/tick
- SVG graphics: 16384 bytes/tick
## Solution
Replace thread-per-round with a single persistent bot thread that lives for the process lifetime. Between rounds it blocks on a channel waiting for the next round-start signal. This keeps the allocator alive, eliminating all fixed-array workarounds.
## Files
- `src/robocode_tankroyale_botapi/bot.nim` (thread lifecycle, fixed arrays)
- `src/robocode_tankroyale_botapi/event_queue.nim` (fixed array)
- `src/robocode_tankroyale_botapi/graphics.nim` (fixed array)
Fixed in v1.0.2. Bot thread is now persistent across rounds — created once, waits on a channel between rounds. All fixed-array workarounds removed, normal seq/string restored. Validated with 3-round battle test.
Fixed in v1.0.2. Bot thread is now persistent across rounds — created once, waits on a channel between rounds. All fixed-array workarounds removed, normal seq/string restored. Validated with 3-round battle test.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Problem
A new bot thread is created every round via
createThread/joinThread. When thread N dies, its ORC allocator is destroyed, but module-levelseq/stringglobals still reference its heap blocks. Thread N+1 touching those globals causes SIGSEGV inprepareSeqAddUninit/rawDealloc.Current workarounds use fixed-size arrays with silent ceilings:
Solution
Replace thread-per-round with a single persistent bot thread that lives for the process lifetime. Between rounds it blocks on a channel waiting for the next round-start signal. This keeps the allocator alive, eliminating all fixed-array workarounds.
Files
src/robocode_tankroyale_botapi/bot.nim(thread lifecycle, fixed arrays)src/robocode_tankroyale_botapi/event_queue.nim(fixed array)src/robocode_tankroyale_botapi/graphics.nim(fixed array)Fixed in v1.0.2. Bot thread is now persistent across rounds — created once, waits on a channel between rounds. All fixed-array workarounds removed, normal seq/string restored. Validated with 3-round battle test.