Skip to content

memory_profile=True crashes program due to state contamination (multiple reason() calls) #86

@sonikirtik

Description

@sonikirtik

Description: When setting pr.settings.memory_profile = True, the program crashes. This appears to happen because the memory profiler attempts to run the reasoning process multiple times (once for execution, once for profiling) without resetting the graph state in between.

As a result, the second internal run leads to logical inconsistencies or index errors depending on the initial conditions.

Steps to Reproduce:

  • Create a simple PyReason script.
  • Enable the memory profile setting: pr.settings.memory_profile = True.
  • Run pr.reason().

Expected Behavior: The program should profile memory usage without altering the logical flow or crashing. The profiler should implicitly call reset() or isolate the profiling run so it does not conflict with the main execution state.

Actual Behavior: pr.reason() executes multiple times, leading to loss of any coherent output.

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