aboutsummaryrefslogtreecommitdiff
path: root/core/encoding
diff options
context:
space:
mode:
authorKarl Zylinski <karl@zylinski.se>2023-11-01 00:46:01 +0100
committerKarl Zylinski <karl@zylinski.se>2023-11-01 00:46:01 +0100
commit942e91f94c47fc6057da06f4aa320f9a150adfe1 (patch)
treef3629f524ab0ecef713ff71f4b2624b05b10e83c /core/encoding
parentd8f06ed55741fe52ec7bf260dddc1a369cfa05a7 (diff)
Added temp allocator guard to json.marshal, in case we temp alloc when sorting map kesy
Diffstat (limited to 'core/encoding')
-rw-r--r--core/encoding/json/marshal.odin3
1 files changed, 3 insertions, 0 deletions
diff --git a/core/encoding/json/marshal.odin b/core/encoding/json/marshal.odin
index 80b2e4dd4..9ef78b95d 100644
--- a/core/encoding/json/marshal.odin
+++ b/core/encoding/json/marshal.odin
@@ -83,6 +83,9 @@ marshal_to_writer :: proc(w: io.Writer, v: any, opt: ^Marshal_Options) -> (err:
return
}
+ // temp guard in case we are sorting map keys, which will use temp allocations
+ runtime.DEFAULT_TEMP_ALLOCATOR_TEMP_GUARD()
+
ti := runtime.type_info_base(type_info_of(v.id))
a := any{v.data, ti.id}