You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following code snippet will leak memory with the default gc in Nim 1.4.8 and the latest development build. Araq believes this is an issue with the library rather than with Nim.
while true:
var totStr = ""
for item in seqOfDecimals:
totStr &= $item
The text was updated successfully, but these errors were encountered:
I guess it's because we aren't freeing the cstring returned by mpd_to_sci. Does Nim have anyway of doing it out of the box or do we need to wrap a free function from C?
I'm not yet familiar with using the nim c interop and building nimble packages, but is seems a simple patch such as below could resolve the leak. Could someone with more than my current expertise make a fix?
Thanks,
proc `$`*(s: DecimalType): string =
## Convert DecimalType to string
let cs = mpd_to_sci(s[], 0)
result = $cs
c_free(cs)
The following code snippet will leak memory with the default gc in Nim 1.4.8 and the latest development build. Araq believes this is an issue with the library rather than with Nim.
The text was updated successfully, but these errors were encountered: