This Go program serves as a resource leak simulator, capable of intentionally causing memory leaks and file descriptor leaks for educational or research purposes. The program provides command-line options to control the type of resource to leak.
- Clone this repository.
- Navigate to the directory containing the source code.
- Run
go buildto compile the program.
Run the compiled executable with the desired flags to simulate the corresponding type of resource leak:
-
To leak file descriptors:
./leaky --fds
-
To leak memory:
./leaky --memory
-
To leak both file descriptors and memory:
./leaky --fds --memory
--fds: Activate file descriptor leak.--memory: Activate memory leak.