Skip to content

Fix memory allocations counters on macOS.#2673

Merged
Lukasa merged 1 commit intoapple:mainfrom
gmilos:gm-fix-allocation-counters-on-macOS
Mar 6, 2024
Merged

Fix memory allocations counters on macOS.#2673
Lukasa merged 1 commit intoapple:mainfrom
gmilos:gm-fix-allocation-counters-on-macOS

Conversation

@gmilos
Copy link
Copy Markdown
Contributor

@gmilos gmilos commented Mar 6, 2024

Motivation

Allocation counters are broken on macOS as described here: #2672. This PR fixes it.

Modifications

AtomicCounter library is made .dynamic. This deduplicates the two (static) copies that used to exist. One embedded in the main binary, and the other in HookedFunctions dylib. This deplication fixes the issue, because there is just one copy of the counters in the process address space.

Result

All the tests counting allocations and related statistics work on macOS.

Motivation:

Allocation counters are broken on macOS as described [here](apple#2672). This PR fixes it.

Modifications:

`AtomicCounter` library is made `.dynamic`. This deduplicates the two (static) copies that used to exist. One embedded in the main binary, and the other in `HookedFunctions` dylib. This deplication fixes the issue, because there is just one copy of the counters in the process address space.

Result:

All the tests counting allocations and related statistics work on macOS.
@gmilos gmilos marked this pull request as ready for review March 6, 2024 12:16
@gmilos gmilos requested review from FranzBusch and weissi March 6, 2024 12:16
@gmilos gmilos enabled auto-merge (squash) March 6, 2024 12:16
@Lukasa Lukasa added the semver/none No version bump required. label Mar 6, 2024
@Lukasa Lukasa disabled auto-merge March 6, 2024 14:46
@Lukasa Lukasa merged commit fc63f0c into apple:main Mar 6, 2024
@glbrntt glbrntt linked an issue Apr 9, 2024 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

semver/none No version bump required.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allocation counter tests don't work on macOS

2 participants