All pastes #885523 Raw Edit

Anonymous

public text v1 · immutable
#885523 ·published 2008-01-30 23:12 UTC
rendered paste body
#include <sys/types.h>
#include <sys/time.h>
#include <sys/resource.h>

#include <stdio.h>
#include <stdlib.h>

int main(void)
{
  struct rlimit     lim;
  int i;
  
  if(getrlimit(RLIMIT_AS, &lim) == -1) return 1;
  printf("%d\n", lim.rlim_cur);
  
  lim.rlim_cur = lim.rlim_max = 100 * 1024;
  if(setrlimit(RLIMIT_AS, &lim) == -1) return 2;
  
  if(getrlimit(RLIMIT_AS, &lim) == -1) return 1;
  printf("%d\n", lim.rlim_cur);
  
  char *v = malloc(100000000);
  for (i=1;i<1000000;i++)
    v[i]=(v[i-1]+3)%200; // pour pas que le malloc se fasse optimiser, on sait jamais
  printf("%d\n",42);
    
}