---
name: "PAPI_destroy_eventset"
section: "3"
platform: "linux"
package: "libpapi-dev"
version: "7.1.0-5+b1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/PAPI_destroy_eventset"
---

# PAPI\_destroy\_eventset(3)

Empty and destroy an EventSet.

## NAME

PAPI\_destroy\_eventset - Empty and destroy an EventSet.

## SYNOPSIS

## Detailed Description

**C Interface:**

\#include \<**papi.h**\> \
\
  int **PAPI\_destroy\_eventset( int \* EventSet )**;

**PAPI\_destroy\_eventset** deallocates the memory associated with an empty PAPI EventSet.

**Parameters**

*\*EventSet* A pointer to the integer handle for a PAPI event set as created by **PAPI\_create\_eventset**. The value pointed to by EventSet is then set to PAPI\_NULL on success.

**Return values**

*PAPI\_EINVAL* One or more of the arguments is invalid. Attempting to destroy a non-empty event set or passing in a null pointer to be destroyed. \
 *PAPI\_ENOEVST* The EventSet specified does not exist. \
 *PAPI\_EISRUN* The EventSet is currently counting events. \
 *PAPI\_EBUG* Internal error, send mail to ptools-perfapi@icl.utk.edu and complain.

**Examples:**

```
// Free all memory and data structures, EventSet must be empty.
if ( PAPI_destroy_eventset( &EventSet ) != PAPI_OK )
handle_error( 1 );
```

**See also**

**PAPI\_profil** \
\
  **PAPI\_create\_eventset** \
\
  **PAPI\_add\_event** \
\
  **PAPI\_stop**

## Author

Generated automatically by Doxygen for PAPI from the source code.
