Reputation: 417
For a presentation about memory leaks, i'd like to present a program where a memory leak could be easy to do, and would have visual effects; how could i do this ?
I don't want to use any language in particular, even if C, java or Python would be prefered.
Thank you.
Upvotes: 0
Views: 41
Reputation: 1074
This would produce memory leaks in your system.
#include <stdio.h>
int main(void) {
// your code goes here
char *c;
for(;;)
c = (char*)malloc(sizeof(char));
return 0;
}
Upvotes: 2