C Memory Police highlights memory leaks and invalid frees in your C code right as you type. It tracks malloc, calloc, and realloc calls inside your functions, keeping an eye out for pointers that escape without being properly free()d.
What it does
Catches unmatched malloc, calloc, and realloc calls within your functions.
Prevents double frees or invalid frees (like trying to free() a pointer that was just swallowed by realloc).
Looks inside your #include "..." files to figure out if your custom functions allocate memory behind the scenes.
Ignores allocations that intentionally escape (like returning a pointer or saving it to a struct), so you aren't flooded with false positives.
Works in real-time. Just open a .c file and start typing.
How to use it
It runs automatically when you open any C file. You'll see warning squiggles under tricky memory operations, along with details in the Problems panel and right inside your editor next to the broken line.
If you ever want to quickly toggle it off and on, you can use the command C Memory Police: Toggle Diagnostics or hit Ctrl+Alt+F (Cmd+Alt+F on Mac).
How it works under the hood
It relies on fast, lightweight static analysis via regex to figure out if you missed a free. You don't need a heavy language server running or any extra compiler flags. Just pure, instant feedback!