Browse Source

Added temp allocator guard to json.marshal, in case we temp alloc when sorting map kesy

Karl Zylinski 1 year ago
parent
commit
942e91f94c
1 changed files with 3 additions and 0 deletions
  1. 3 0
      core/encoding/json/marshal.odin

+ 3 - 0
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}