Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spicy-build: High memory consumption reading files. #1624

Closed
J-Gras opened this issue Dec 20, 2023 · 2 comments · Fixed by #1679
Closed

spicy-build: High memory consumption reading files. #1624

J-Gras opened this issue Dec 20, 2023 · 2 comments · Fixed by #1679
Assignees

Comments

@J-Gras
Copy link
Contributor

J-Gras commented Dec 20, 2023

While processing a file (-f) with an executable created by spicy-build the process' memory consumption is constantly growing up to the size of the input file. Looks like processed input is never released. Running the same parser using spicy-driver, the memory consumption is stable.

@bbannier
Copy link
Member

This is a current limitation of spicy-build. The way it generates C++ code does not work with optimizations enabled, so it disables them,

execute $(${spicy_config} --spicyc) -g ${hiltic_flags} -c -o ${cc} ${i} || exit 1

Random access is currently always enabled for all units, but removed for units which do not need it by the optimizer. Since spicy-build does not optimize random access is always on. This e.g., means that input is not trimmed leading to the growth you reported.

@bbannier
Copy link
Member

It might be possible to rewrite spicy-build so instead of disabling optimizations it leaves them on and possibly makes use of spicyc's -x flag to emit sources and using a single invocation of spicyc. With that we might have a global enough view to emit all required code, even after optimizations.

@bbannier bbannier self-assigned this Feb 26, 2024
bbannier added a commit that referenced this issue Feb 26, 2024
We previously would emit single C++ source files from `spicy-build`.
This made it impossible to enable optimizations since we could not know
whether individual code was used. Since optional features are by default
enabled and only disabled through an optimizer pass this meant that
`spicy-build` emitted code which performed a lot of work not done
usually.

This patch reworks `spicy-build` to use `spicyc`'s `-x` instead which
has a global view and can run optimizations, and emits all source files
into a prefix.

Closes #1624.
Closes #1625.
Closes #1622.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants