Skip to content

Proper cleanup of coroutine stacks #153

Description

@nbosb

Describe the bug
At the end of the simulation, the stack of the coroutines (SC_THREAD) is not properly cleaned up. When a local variable is created in an SC_THREAD, the destructor might not be called.

To Reproduce
The behavior can, e.g., be seen in the systemc-1666-2011-compliance-method_with_reset test, which fails when a sanitizer is used (leak sanitizer). The problem is that the destructor or_list, which is a local variable of the multiple_reset_handler SC_THREAD, is never called:

When the variable is moved to the class, the test succeeds.

Expected behavior
The coroutine stacks are cleaned up, and the destructors of local variables are called.

Environment
OS: e.g., Ubuntu 24.04
Compiler: Clang 14 with -fsanitize=address
SystemC version: e.g., 3.0.2

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions