PMFREERESULT(3)

πŸ“¦
version 6.3.8 Β· 3 versions
, in centos-stream 9, debian trixie, opensuse-leap 16.0, ubuntu noble, ubuntu questing

πŸ’– PMFREERESULT(3) β€” the "bestie please clean up after yourself" page πŸ’–

okay so welcome to the manual page for pmFreeResult and pmFreeHighResResult β€” the two little cleanup queens of the PCP world. Their whole job? Release the storage that was allocated for performance metrics values. That's it. That's the gig. And honestly? They ate. ✨


🌸 NAME 🌸

pmFreeResult, pmFreeHighResResult β€” release storage allocated for performance metrics values 🧹🫢


✨ C SYNOPSIS ✨

#include <pcp/pmapi.h>

void pmFreeResult(pmResult *result);
void pmFreeHighResResult(pmHighResResult *result);

cc ... -lpcp

no cap, that's the whole signature. no return value. no drama. she just frees and dips. πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

Okay bestie, listen up, this part matters.

The variable sized results that come back from pmFetch(3) and pmFetchHighRes(3) are allocated below the Performance Metrics Application Programming Interface (PMAPI) using a combo of dynamic allocation (that's malloc(3), the classic) and some specialized allocation strategies. So like, it's not just one boring malloc situation, it's giving layered. πŸŽ€

So when your app is done peeking at that pmResult structure and genuinely no longer needs access to it, you call pmFreeResult to release the storage that was previously allocated for result by pmFetch(3). That's the move. That's the whole vibe. 🌈

⚠️ UNDER NO CIRCUMSTANCES should an application use free(result) to release storage previously allocated for a pmResult by pmFetch(3). Like. Do not. I am begging. 😭 That is not it, bestie β€” it's a whole different allocation strategy situation and free() does not know her.

Similarly, memory allocated for the high resolution timestamped result structure that comes back from pmFetchHighRes(3) should be released by a call to pmFreeHighResResult. Same energy, different struct. ⭐

So basically: you fetched it, you free it β€” but you free it with her function, not with plain old free(). iykyk. πŸ’œ


πŸ‘‘ SEE ALSO πŸ‘‘


and that's the page, bestie!! πŸŽ€βœ¨ this icon was brought to you by Performance Co-Pilot (that's the PCP girlies 🫢), sittin' pretty on the PCP manual, filed under PMFREERESULT(3) β€” go free your results, not your vibes. πŸ’…πŸ’–

πŸ“¦ where this page comes from