Skip to content

Referring to the current stack-frame creates unnecessary reference cycles #2149

@bdbaddog

Description

@bdbaddog

This issue was originally created at: 2008-07-24 09:46:07.
This issue was reported by: pankrat.
pankrat said at 2008-07-24 09:46:08

This patch avoids creating unnecessary reference cycles. SCons throws a
division-by-zero exception to get access and walk the parent stack-frames. This
is no problem as long as the current stack-frame isn't referred to by a local
variable.

Empirical observations indicate that approximately half of the objects involved
in reference cycles and collected by the garbage collector are held because of
those frame objects. This can be easily avoided by starting the iteration with
the parent stack-frame, instead of the own stack-frame.

I believe this to be a zero-cost patch without the need for additional
documentation or tests.

For example, here is the summary of the Heapmonitor Garbage tracker for an
up-to-date check of Ardour:

Without the patch:

$ scons --debug=garbage
...
Garbage: 194515 collected objects ( 89319 in cycles): 66.95 MB

With the patch applied:

$ scons --debug=garbage
...
Garbage: 100536 collected objects ( 23987 in cycles): 36.85 MB

Further discussions of reference cycles can be found in:
http://www.scons.org/wiki/LudwigHaehne/ReferenceCycles

pankrat said at 2008-07-24 09:47:22

Created an attachment (id=454)
Proposed patch avoiding frame reference cycles

gregnoel said at 2008-07-29 06:09:40

Bug party triage.

gregnoel said at 2008-09-09 14:55:18

Bug party triage. Go for it.

pankrat said at 2008-09-10 09:25:15

Fixed in r3383.

More information about this issue is at http://www.scons.org/wiki/LudwigHaehne/ReferenceCycles.

pankrat attached leak_frame.patch at 2008-07-24 09:47:21.

Proposed patch avoiding frame reference cycles

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions