Skip to content

Commit

Permalink
Fix memory allocations counters on macOS. (#2673)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
gmilos committed Mar 6, 2024
1 parent 5e47077 commit fc63f0c
Showing 1 changed file with 1 addition and 1 deletion.
Expand Up @@ -19,7 +19,7 @@ import PackageDescription
let package = Package(
name: "AtomicCounter",
products: [
.library(name: "AtomicCounter", targets: ["AtomicCounter"]),
.library(name: "AtomicCounter", type: .dynamic, targets: ["AtomicCounter"]),
],
dependencies: [ ],
targets: [
Expand Down

0 comments on commit fc63f0c

Please sign in to comment.