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

bug: AttachDebugInfo() contributes to most memory usage regardless of debug.Debug flag value #1157

Closed
Scratch-net opened this issue Jun 6, 2024 · 0 comments · Fixed by #1160
Assignees
Labels

Comments

@Scratch-net
Copy link

Description

While profiling gnark during compilation and proof phaze I noticed that AttachDebugInfo and in turn NewDebugInfo contribute to large (if not the largest) portion of memory. In my case it was 500mb out of 800.

Expected Behavior

Do not create anything in NewDebugInfo if debug.Debug is set to false

Actual Behavior

NewDebugInfo() contributes to memory growth regardless of debug.Debug const value

Possible Fix

smth like

NewDebugInfo(errName string, i ...interface{}) DebugInfo {
	var l LogEntry

	if !debug.Debug{
		return DebugInfo(l)
	}
	...

would do the job

Context

We are planning to run gnark on mobile devices where memory consumption turns to be critical

Your Environment

  • gnark version used (e.g. v0.10.0):
@gbotrel gbotrel self-assigned this Jun 6, 2024
@gbotrel gbotrel added the perf label Jun 6, 2024
gbotrel added a commit that referenced this issue Jun 10, 2024
gbotrel added a commit that referenced this issue Jun 11, 2024
#1160)

* fix: fixes #1157 ensures calls to AttachDebugInfo are surrounded with compile time check on debug.Debug

* fix: apply PR suggested diff
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants