File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -95,10 +95,15 @@ fn collectSpecFiles(
9595
9696/// Runs all requests in a spec file and updates the reporter.
9797fn runTest (
98- allocator : std.mem.Allocator ,
98+ base_allocator : std.mem.Allocator ,
9999 reporter : * TestReporter.BasicReporter ,
100100 path : []const u8 ,
101101) void {
102+ // Create arena allocator for this test to provide memory isolation
103+ var arena = std .heap .ArenaAllocator .init (base_allocator );
104+ defer arena .deinit (); // Automatically frees all test allocations
105+ const allocator = arena .allocator ();
106+
102107 var has_failure = false ;
103108 reporter .incTestCount ();
104109
@@ -112,13 +117,13 @@ fn runTest(
112117 std .debug .print ("Failed to convert items to owned slice in file {s}: {s}\n " , .{ path , @errorName (err ) });
113118 return ;
114119 };
115- defer allocator . free ( owned_items );
120+ // Note: No need to manually free owned_items since arena will handle it
116121
117122 var client = Client .HttpClient .init (allocator );
118123 defer client .deinit ();
119124
120125 for (owned_items ) | * owned_item | {
121- defer owned_item . deinit ( allocator );
126+ // Note: No need to manually deinit owned_item since arena will handle it
122127 var responses = client .execute (owned_item ) catch | err | {
123128 reporter .incTestInvalid ();
124129 std .debug .print ("Failed to execute request in file {s}: {s}\n " , .{ path , @errorName (err ) });
You can’t perform that action at this time.
0 commit comments