Skip to content

Instantly share code, notes, and snippets.

@Oxore
Last active August 7, 2017 19:16
Show Gist options
  • Save Oxore/a655a05fe3700e0f1ac82ed617ab8cc6 to your computer and use it in GitHub Desktop.
Save Oxore/a655a05fe3700e0f1ac82ed617ab8cc6 to your computer and use it in GitHub Desktop.
Утечка в коде как в сях
#include <iostream>
#include <string.h>
#include <stdlib.h>
using namespace std;
int main()
{
void *a;
long int n = 10000000;
while (1) {
a = (char *)malloc(n);
printf("%ld bytes allocated, occupying...", n);
memset(a, 0, n);
printf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b and occupied\n");
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment