Skip to content

Instantly share code, notes, and snippets.

@dortamiguel
dortamiguel / function.cpp
Created December 20, 2024 02:57
function memory leak
#include <pthread.h>
template <typename... Args> struct function {
void (*callable)(void *, Args...) = nullptr;
static constexpr u32 MAX_CONTEXT_SIZE = 32;
char *context = nullptr;
function() : context(new char[MAX_CONTEXT_SIZE]) {}
template <typename Type> function(Type _function) : function() {