Limit the number of pooled objects

This commit is contained in:
Jarred Sumner
2022-02-01 20:47:35 -08:00
parent 170e58a99d
commit 213960a04a
12 changed files with 61 additions and 14 deletions

View File

@@ -958,6 +958,7 @@ pub const ZigConsoleClient = struct {
}
}.init,
true,
16,
);
};

View File

@@ -784,7 +784,7 @@ pub const DescribeScope = struct {
this.tests.deinit(getAllocator(ctx));
}
const ScopeStack = ObjectPool(std.ArrayListUnmanaged(*DescribeScope), null, true);
const ScopeStack = ObjectPool(std.ArrayListUnmanaged(*DescribeScope), null, true, 16);
// pub fn runBeforeAll(this: *DescribeScope, ctx: js.JSContextRef, exception: js.ExceptionRef) bool {
// var scopes = ScopeStack.get(default_allocator);

View File

@@ -463,8 +463,8 @@ pub const Fetch = struct {
reject: js.JSObjectRef = null,
context: FetchTaskletContext = undefined,
const Pool = ObjectPool(FetchTasklet, init, true);
const BodyPool = ObjectPool(MutableString, MutableString.init2048, true);
const Pool = ObjectPool(FetchTasklet, init, true, 32);
const BodyPool = ObjectPool(MutableString, MutableString.init2048, true, 8);
pub const FetchTaskletContext = struct {
tasklet: *FetchTasklet,
};