mirror of
https://github.com/google/flatbuffers.git
synced 2026-07-04 11:31:11 +00:00
[Swift] Memory usage fix (#8643)
Allows a complete reset for the underlying memory of the _InternalByteBuffers within FlatBuffers and FlexBuffers.
This commit is contained in:
@@ -32,7 +32,11 @@ func createProperBuffer() -> FlexBuffersWriter {
|
||||
var fbx = FlexBuffersWriter(
|
||||
initialSize: 8,
|
||||
flags: .shareKeysAndStrings)
|
||||
write(fbx: &fbx)
|
||||
return fbx
|
||||
}
|
||||
|
||||
func write(fbx: inout FlexBuffersWriter) {
|
||||
fbx.map { map in
|
||||
map.vector(key: "vec") { v in
|
||||
v.add(int64: -100)
|
||||
@@ -57,5 +61,4 @@ func createProperBuffer() -> FlexBuffersWriter {
|
||||
}
|
||||
|
||||
fbx.finish()
|
||||
return fbx
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user