liquidsoap icon indicating copy to clipboard operation
liquidsoap copied to clipboard

Memory leak parsing YAML

Open ohrstrom opened this issue 10 months ago • 1 comments

Describe the bug When parsing YAML data I did notice that the memory used by Liquidsoap constantly increases.
(Parsing the same data with JSON does work without problems.)

Is this probably related to https://github.com/avsm/ocaml-yaml/issues/73 ?

To Reproduce

# YAML Example
thread.run.recurrent(
 fast=false,
 delay=0.,
 fun() -> begin
  let yaml.parse ({
    rms,
    peak,
  } : {
    rms: {left: float, right: float},
    peak: {left: float, right: float}
  }) = "rms:\n  left: 0.762534253621\n  right: 0.762534253621\npeak:\n  left: 0.923847581029\n  right: 0.923847581029"
  0.01
 end
)

output.dummy(sine())
# top output YAML
43817  liquidsoap       4.9   00:02.90 10    0   29     97M+ 
43817  liquidsoap       3.9   00:02.95 10    0   29     100M+
43817  liquidsoap       4.4   00:02.99 10    0   29     103M+
43817  liquidsoap       5.1   00:03.05 10    0   29     107M+
43817  liquidsoap       5.5   00:03.11 10    0   29     110M+
43817  liquidsoap       4.6   00:03.16 10    0   29     114M+
43817  liquidsoap       4.4   00:03.21 10    0   29     117M+
43817  liquidsoap       4.3   00:03.26 10    0   29     121M+
43817  liquidsoap       4.9   00:03.32 10    0   29     124M+
43817  liquidsoap       4.5   00:03.37 10    0   29     128M+
43817  liquidsoap       4.4   00:03.42 10    0   29     131M+
# JSON Example
thread.run.recurrent(
 fast=false,
 delay=0.,
 fun() -> begin
  let json.parse ({
    rms,
    peak,
  } : {
    rms: {left: float, right: float},
    peak: {left: float, right: float}
  }) = '{"rms": {"left": 0.762534253621,"right": 0.762534253621},"peak": {"left": 0.923847581029,"right": 0.923847581029}}'
  0.01
 end
)

output.dummy(sine())
# top output JSON
40021  liquidsoap       12.2  00:02.77 10    0   29+    90M-
40021  liquidsoap       4.4   00:02.82 10    0   29     90M+
40021  liquidsoap       4.5   00:02.87 10    0   29     90M
40021  liquidsoap       3.7   00:02.91 10    0   29     90M
40021  liquidsoap       4.9   00:02.96 10    0   29     90M
40021  liquidsoap       4.0   00:03.01 10    0   29     90M
40021  liquidsoap       4.6   00:03.06 10    0   29     90M
40021  liquidsoap       3.4   00:03.10 10    0   29     90M
40021  liquidsoap       4.0   00:03.14 10    0   29     90M
40021  liquidsoap       3.3   00:03.18 10    0   29     90M
40021  liquidsoap       2.5   00:03.21 10    0   29     90M

Expected behavior The memory-consumption should not increase over time.

Version details

  • OS: same behaviour on macOS (13.5.2) and Debian (12)
  • Version: same behaviour with LS 2.2.3 and 2.2.4-1

Install method Installed via opam

# eventualy relevant yaml versions
Using: ...
yaml=3.2.0 yaml.bindings=3.2.0 yaml.bindings.types=3.2.0 yaml.c=3.2.0 yaml.ffi=3.2.0 yaml.types=3.2.0

ohrstrom avatar Apr 15 '24 14:04 ohrstrom