Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: mesa/mesa
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v3.4.1
Choose a base ref
...
head repository: mesa/mesa
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v3.4.2
Choose a head ref
  • 9 commits
  • 12 files changed
  • 3 contributors

Commits on Jan 23, 2026

  1. Update Ruff hook id in pre-commit config

    Switch the Ruff pre-commit hook from the deprecated `ruff` legacy alias to the canonical `ruff-check` hook ID, aligning the configuration with upstream changes in `ruff-pre-commit` and eliminating the “legacy alias” warning while preserving existing linting and auto-fix behavior.
    
    See astral-sh/ruff-pre-commit#124
    EwoutH committed Jan 23, 2026
    Configuration menu
    Copy the full SHA
    7ee8235 View commit details
    Browse the repository at this point in the history
  2. move test_grid to correct location

    Sonu0305 authored and EwoutH committed Jan 23, 2026
    Configuration menu
    Copy the full SHA
    bd08742 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    12250ae View commit details
    Browse the repository at this point in the history
  4. docstring fixes (#3124)

    Sonu0305 authored and EwoutH committed Jan 23, 2026
    Configuration menu
    Copy the full SHA
    7687c17 View commit details
    Browse the repository at this point in the history
  5. docstring fixes (#3127)

    Sonu0305 authored and EwoutH committed Jan 23, 2026
    Configuration menu
    Copy the full SHA
    66038fc View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    3a19ee6 View commit details
    Browse the repository at this point in the history
  7. Add Mesa development process guidelines (#3135)

    Expanded CONTRIBUTING.md with detailed information about Mesa's development philosophy, contribution workflow, and best practices for proposing and implementing features. This addition aims to help contributors understand when to open issues, discussions, or PRs, and outlines the stages of problem alignment, design, and implementation.
    EwoutH committed Jan 23, 2026
    Configuration menu
    Copy the full SHA
    6942d31 View commit details
    Browse the repository at this point in the history
  8. Fix memory leak (#3180)

    A memory leak was discovered in Mesa where model instances could never be garbage collected after agents were created. The root cause was the `Agent._ids` class attribute—a `defaultdict` that stored references to model instances to ensure `unique_id` values were unique on a per-model basis. Because `_ids` was a class-level attribute that persisted across the Python process, any model instance used as a key in this dictionary maintained a hard reference indefinitely, preventing the garbage collector from cleaning up the model and all its associated objects (agents, grids, etc.) even after the model went out of scope or was explicitly deleted.
    
    This bug had significant practical consequences for Mesa users, particularly those running multiple simulations or batch experiments. Each time a model was instantiated and run within a function, the model objects would accumulate in RAM rather than being cleaned up when the function exited. This meant that running many model instances—common in parameter sweeps, sensitivity analyses, or optimization workflows—would cause unbounded memory growth, eventually exhausting available RAM. The issue was especially problematic because it was invisible to users: simply letting a model go out of scope or calling `del model` appeared to work but silently retained all the memory, and even explicitly removing agents with `model.remove_all_agents()` only partially addressed the problem depending on the space types used.
    
    The fix moved the `unique_id` assignment logic from the `Agent` class into the `Model.register_agent()` method, eliminating the problematic class-level `_ids` defaultdict entirely. Instead of tracking IDs across all model instances in a shared dictionary, each model now maintains its own `agent_id_counter` instance attribute that starts at 1 and increments with each registered agent. This approach ensures that `unique_id` remains unique within each model instance while allowing the garbage collector to properly clean up model objects when they go out of scope, since there are no longer any persistent class-level references to model instances. The fix also replaced `itertools.count` with simple integer incrementation, which avoids upcoming pickle compatibility issues in Python 3.14.
    quaquel authored and EwoutH committed Jan 23, 2026
    Configuration menu
    Copy the full SHA
    5f13d6b View commit details
    Browse the repository at this point in the history
  9. Update release notes and version for 3.4.2

    Update version and release notes for the next patch release, Mesa 3.4.2.
    EwoutH committed Jan 23, 2026
    Configuration menu
    Copy the full SHA
    7287946 View commit details
    Browse the repository at this point in the history
Loading