{"id":23239043,"url":"https://github.com/teemperor/libmemintercept","last_synced_at":"2025-04-05T21:41:00.926Z","repository":{"id":44719092,"uuid":"453032209","full_name":"Teemperor/libmemintercept","owner":"Teemperor","description":"Library for intercepting memory allocation functions (malloc, free, ...)","archived":false,"fork":false,"pushed_at":"2022-01-28T17:54:57.000Z","size":13,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-12T01:55:36.230Z","etag":null,"topics":["cpp","free","malloc","malloc-free","memory-allocation"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Teemperor.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-01-28T10:51:10.000Z","updated_at":"2022-01-28T14:29:18.000Z","dependencies_parsed_at":"2022-07-20T15:02:14.538Z","dependency_job_id":null,"html_url":"https://github.com/Teemperor/libmemintercept","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Teemperor%2Flibmemintercept","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Teemperor%2Flibmemintercept/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Teemperor%2Flibmemintercept/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Teemperor%2Flibmemintercept/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Teemperor","download_url":"https://codeload.github.com/Teemperor/libmemintercept/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247406077,"owners_count":20933803,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cpp","free","malloc","malloc-free","memory-allocation"],"created_at":"2024-12-19T04:21:20.258Z","updated_at":"2025-04-05T21:41:00.907Z","avatar_url":"https://github.com/Teemperor.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# libmemintercept\nLibrary for intercepting memory allocation functions (malloc, free, ...).\n\n## Build instructions\n\n```bash\n# Create build directory.\nmkdir build ; cd build\n# Run CMake to setup build directory.\ncmake .. -GNinja\n# Build.\nninja\n# Build and run tests.\nninja check\n```\n\n## How to use\n\nSee the `examples/` directory for compiling examples.\n\nA minimal example is:\n\n```cpp\n#include \"libmemintercept.h\"\n#include \u003ccstdio\u003e\n\n// Your backend. See Memcallback's documentation for available hooks.\nstruct PrintFrees : libmemintercept::MemCallback {\n  void memoryAllocated(void *addr, std::size_t size) {}\n\n  void memoryReallocated(void *old_addr, void *new_addr,\n                                 std::size_t new_size) override {}\n\n  void memoryFreed(void *addr) override {\n    fprintf(stderr, \"free(%p)\\n\", addr);\n  }\n};\n\n// Sets up hook.\nLIBMEMINTERCEPT_ADD_CB(PrintFrees)\n```\n\nThis needs to link against `libmemintercept` to work and should be compiled into a shared objetc.\n\nTo actually intercept a process do:\n\n```bash\n$ LD_PRELOAD=path/to/your.so binary_you_want_to_intercept\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fteemperor%2Flibmemintercept","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fteemperor%2Flibmemintercept","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fteemperor%2Flibmemintercept/lists"}