Skip to content

Memory Leaks on iOS TOMLTable.convert(to:options:) #26

@codingiran

Description

@codingiran

My Code is quit simple:

// a toml string
var tomlString = '''
port = 6789
socks_port = 7890
allow_lan = false
bind_address = '*'
log_level = 'debug'
ipv6 = false
tun_fd = 0
'''
// `NetspeedConfig` is a Swift Struct define in my app
var config = try TOMLDecoder().decode(NetspeedConfig.self, from: tomlString)

// set property etc.
config.tun_fd = 10
...

// convert to toml string
tomlString = try TOMLEncoder().encode(config)

// create a TOMLKit table
let table = try TOMLTable(string: tomlString)

// convert to strings
let output_toml = table.convert(to: .toml)
let output_json = table.convert(to: .json)
let output_yaml = table.convert(to: .yaml)
iShot_2024-01-09_16 46 58

Xcode Instruments catch this memory leak, please download it and check in Xcode
https://github.com/codingiran/TOMLKit/blob/main/MemoryLeaks/TOMlKit%20Memory%20Leaks.trace.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions