Problem
9 live integration tests fail consistently due to memory leaks detected by testing.allocator (GPA) and a missing HTTP status check.
Failing Tests
| # |
Test |
Root Cause |
| 1 |
Azure streamText |
Missing defer deinit in test |
| 2 |
Anthropic streamText |
Missing defer + provider leaks streaming IDs |
| 3 |
Google streamText |
Missing defer + provider leaks text copies |
| 4 |
OpenAI generateObject |
generateObject passes base allocator to doGenerate |
| 5 |
Anthropic generateObject |
Same as #4 |
| 6 |
Google generateObject |
Same as #4 |
| 7 |
Google streamObject |
streamObject passes base allocator to doStream |
| 8 |
Google embed |
No HTTP status code check → parses error body as response |
| 9 |
Google embedMany |
Same as #8 |
Fix Summary
- Add missing
defer http_client.deinit() and defer provider.deinit() to all streamText tests
- Anthropic streaming: use
stream_allocator for ephemeral IDs instead of result_allocator
- Google streaming: use
request_allocator for text/function call copies instead of result_allocator
generateObject: pass arena_allocator to doGenerate, dupe result strings to base allocator
streamObject: pass arena_allocator to doStream
- Google embedding: add HTTP status code check before parsing response body
Problem
9 live integration tests fail consistently due to memory leaks detected by
testing.allocator(GPA) and a missing HTTP status check.Failing Tests
generateObjectpasses base allocator to doGeneratestreamObjectpasses base allocator to doStreamFix Summary
defer http_client.deinit()anddefer provider.deinit()to all streamText testsstream_allocatorfor ephemeral IDs instead ofresult_allocatorrequest_allocatorfor text/function call copies instead ofresult_allocatorgenerateObject: passarena_allocatortodoGenerate, dupe result strings to base allocatorstreamObject: passarena_allocatortodoStream