diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2020-04-11 19:59:26 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2020-04-11 23:41:50 -0700 |
commit | 3d7330b827d6e9cc0d9e87edd30388374cb45900 (patch) | |
tree | 2731382bb1425855b2adc4d1420a47e4dfa87eb8 /win/cleansvg.txr | |
parent | a4c376979d15323ad729e92e41ba43768e8dc163 (diff) | |
download | txr-3d7330b827d6e9cc0d9e87edd30388374cb45900.tar.gz txr-3d7330b827d6e9cc0d9e87edd30388374cb45900.tar.bz2 txr-3d7330b827d6e9cc0d9e87edd30388374cb45900.zip |
txr: avoid by-value match_files_ctx passing.
Passing the match_files_ctx structure by value looks nice in
the code, but it is contributing to a long standing false
retention issue.
This test case runs in constant memory:
$ yes | txr -c '@(skip)
n'
skip scans through the lazy list of "y" lines
looking for an "n" that never comes.
This version should also run in constant memory,
but shows unbounded memory growth.
$ yes | txr -c '@(next *stdin*)
@(skip)
n'
This patch doesn't fix it, but it moves things in that
direction.
* match.c (mf_all, mf_args, mf_data, mf_spec,
mf_spec_bindings, mf_file_data, mf_from_ml): Take pointer to structure
which to initialize and return that pointer, instead of
initializing a local structure and returning it by value.
(match_files): Take pointer to context rather than copy.
(h_call, do_match_line, v_fuzz, v_block, v_next_impl,
v_parallel, v_gather, v_collect, v_bind, hv_trampoline,
v_try, v_fun, v_if, v_assesrt, v_load, v_call, match_filter,
match_fun, extract): Adjust to by-pointer context handling of
mf_all, match_files and other functions.
Diffstat (limited to 'win/cleansvg.txr')
0 files changed, 0 insertions, 0 deletions