Skip to content

Commit

Permalink
Merge pull request #28 from calyptia/fix-high-cpu-contention
Browse files Browse the repository at this point in the history
cshared: free the input buffer in a cleanup callback.
  • Loading branch information
niedbalski authored Jan 16, 2023
2 parents e67c8ea + 1d7a2a4 commit f98583e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions cshared.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,13 @@ func FLBPluginInputCallback(data *unsafe.Pointer, csize *C.size_t) int {
return input.FLB_OK
}

// FLBPluginInputCleanupCallback releases the memory used during the input callback
//export FLBPluginInputCleanupCallback
func FLBPluginInputCleanupCallback(data unsafe.Pointer) int {
C.free(data)
return input.FLB_OK
}

// FLBPluginFlush callback gets invoked by the fluent-bit runtime once there is data for the corresponding
// plugin in the pipeline, a data pointer, length and a tag are passed to the plugin interface implementation.
//export FLBPluginFlush
Expand Down

0 comments on commit f98583e

Please sign in to comment.