Skip to content

fix(memory): remove unused WeakReference code or implement properly #16

@usernane

Description

@usernane

Description

Handler::$handlerWeakRefs is declared but never populated. This is either dead code or an incomplete feature.

Current State

// In Handler.php
private static array $handlerWeakRefs = [];

// Referenced in cleanupMemory() but never populated:
self::$handlerWeakRefs = array_filter(self::$handlerWeakRefs, function($weakRef) {
    return $weakRef->get() !== null;
});

Implementation Details

Option A: Remove dead code

  • Remove $handlerWeakRefs property
  • Remove related cleanup code in cleanupMemory()
  • Update getMemoryStats() to not report it

Option B: Implement properly

  • Populate WeakReferences when handlers are registered
  • Use for tracking handler lifecycle without preventing GC

Acceptance Criteria

  • No dead/unused code remains
  • If implemented, add tests for WeakReference behavior

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions