I'm running this following simple C program:
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char** argv){
void *p = malloc(4);
fprintf (stderr, "p==%p
", p);
return 0;
}
Different runs give different results:
p==0x101c010
then: p==0x1ad9010
then: p==0xe77010
and so.
As I remember, in the past malloc was fully deterministic. So probably from some version, some randomness was added to malloc.
I am using now gcc-4.6.3 on Ubuntu.
Is there a way to eliminite that randomness ?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…