Skip to content
This repository was archived by the owner on Aug 27, 2025. It is now read-only.

Commit 4a9efb7

Browse files
Fix memory leak
A long running heap profile of the Scilla process from a ZQ2 node showed growing memory usage. The allocations were mainly happening in `add_comment`. I'm not sure why/where we retain the reference to this forever, but I did see that the only user of `get_comments` was `scilla-fmt`, which we are not using. Therefore, I did the easy fix and removed `scilla-fmt`.
1 parent 7ed9085 commit 4a9efb7

File tree

4 files changed

+4
-221
lines changed

4 files changed

+4
-221
lines changed

src/base/FrontEndParser.ml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,4 @@ module ScillaFrontEndParser (Literal : ScillaLiteral) = struct
147147
let open Result.Let_syntax in
148148
let%bind cmod = parse_string Parser.Incremental.cmodule s in
149149
pure @@ disambiguate_calls cmod
150-
151-
let get_comments () = Lexer.get_comments ()
152150
end

src/base/ScillaLexer.mll

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,6 @@ module MkLexer (S : ParserUtil.Syn) = struct
2828
open Parser
2929

3030
exception Error of string
31-
32-
let comments = ref []
33-
let add_comment start_p s =
34-
let loc = ErrorUtils.toLoc start_p in
35-
comments := (loc, s) :: !comments
36-
let get_comments () = List.rev !comments
3731
}
3832

3933
let digit = ['0'-'9']
@@ -157,8 +151,7 @@ and comment buf braces =
157151
parse
158152
| "(*" { comment buf (lexbuf.lex_curr_p::braces) lexbuf }
159153
| "*)" { match braces with
160-
p::[] -> add_comment p (Buffer.contents buf);
161-
read lexbuf
154+
p::[] -> read lexbuf
162155
| _ -> comment buf (List.tl_exn braces) lexbuf }
163156
| newline { new_line lexbuf;
164157
Buffer.add_char buf '\n';

src/runners/dune

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
(executables
22
(names scilla_runner scilla_checker scilla_server
3-
disambiguate_state_json scilla_fmt scilla_merger scilla_server_http)
3+
disambiguate_state_json scilla_merger scilla_server_http)
44
(public_names scilla-runner scilla-checker
5-
scilla-server disambiguate_state_json scilla-fmt scilla-merger scilla-server-http)
5+
scilla-server disambiguate_state_json scilla-merger scilla-server-http)
66
(package scilla)
77
(modules scilla_runner scilla_checker scilla_server
8-
disambiguate_state_json scilla_fmt scilla_merger scilla_server_http)
8+
disambiguate_state_json scilla_merger scilla_server_http)
99
(libraries core core_unix.command_unix angstrom yojson cryptokit fileutils
1010
scilla_base scilla_eval scilla_server_lib scilla_crypto scilla_format
1111
scilla_merge cmdliner opium memtrace)

src/runners/scilla_fmt.ml

Lines changed: 0 additions & 208 deletions
This file was deleted.

0 commit comments

Comments
 (0)