Page MenuHomeFreeBSD

fix hwpmc memory leaks
ClosedPublic

Authored by markj on Oct 17 2014, 12:25 AM.
Tags
None
Referenced Files
F106139424: D958.diff
Thu, Dec 26, 1:24 AM
Unknown Object (File)
Nov 11 2024, 6:18 PM
Unknown Object (File)
Oct 29 2024, 7:47 PM
Unknown Object (File)
Oct 2 2024, 5:43 PM
Unknown Object (File)
Oct 2 2024, 1:49 PM
Unknown Object (File)
Oct 2 2024, 6:28 AM
Unknown Object (File)
Sep 25 2024, 8:45 AM
Unknown Object (File)
Sep 23 2024, 11:20 PM
Subscribers
None

Details

Summary

hwpmc uses pmc_release_pmc_descriptor() to handle a bunch of PMC cleanup. This function also calls pmc_destroy_pmc_descriptor(), which currently doesn't do anything besides verify a few assertions.

In particular, pmc_release_pmc_descriptor() doesn't actually free() the descriptor - it's up to the caller to do that. There are a few places where this call was missing. I fixed this by changing pmc_destroy_pmc_descriptor() to free() the descriptor (this is consistent with pmc_destroy_owner_descriptor()), and adding missing calls.

Test Plan

It's possible to trigger a leak by running, say, "pmcstat -S unhalted-cycles -T" and killing the pmcstat process with SIGTERM. With this change, the memory leak is fixed and the command still works properly. Isilon's pmc tests pass with this change too.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

markj retitled this revision from to fix memory leaks.
markj updated this object.
markj edited the test plan for this revision. (Show Details)
markj added reviewers: pmc, gnn, bz.
markj retitled this revision from fix memory leaks to fix hwpmc memory leaks.
bz edited edge metadata.

I think this looks ok. At least on first glance I didn't spot a problem or a double-free now.

This revision is now accepted and ready to land.Oct 17 2014, 10:16 AM
gnn edited edge metadata.
markj updated this revision to Diff 2026.

Closed by commit rS273236 (authored by @markj).