mirror of
https://github.com/QingdaoU/Judger.git
synced 2025-01-16 01:13:25 +00:00
update limit.c
This commit is contained in:
parent
88fb3ad073
commit
fec86efecc
24
limit.c
Normal file
24
limit.c
Normal file
@ -0,0 +1,24 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/resource.h>
|
||||
int main()
|
||||
{
|
||||
int *a = NULL;
|
||||
int v = 150;
|
||||
struct rlimit memory_limit;
|
||||
memory_limit.rlim_cur = memory_limit.rlim_max = 90000000;
|
||||
setrlimit(RLIMIT_AS, &memory_limit);
|
||||
printf("111111111111111\n");
|
||||
a = (int *)malloc(v);
|
||||
printf("222222222222222\n");
|
||||
if(a == NULL){
|
||||
printf("error\n");
|
||||
}
|
||||
else {
|
||||
memset(a, 0, v);
|
||||
printf("success\n");
|
||||
}
|
||||
return 0;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user