You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
srs/trunk/research/gperftools/memory.error.tcmalloc.cpp

17 lines
310 B
C++

/**
g++ memory.error.notcmalloc.cpp -g -O0 -o memory.error.notcmalloc
*/
#include <unistd.h>
#include <string.h>
#include <stdio.h>
void foo(char* p){
memcpy(p, "01234567890abcdef", 16);
}
int main(int argc, char** argv){
char* p = new char[10];
foo(p);
printf("p=%s\n", p);
return 0;
}