Skip to content

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

@Scratch-net

Description

@Scratch-net

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):

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions