c - continously allocate the memory to crash the system and how to block it for standard users -


hi tried allocate memory continuously using calloc function . system memory gets filled , crashed. worst part if standard user , if able run program system crashing . how can block happen standard user.

code used :

#include <stdio.h> #include <stdlib.h>  int main() {   while(1)   {     int *abc;     abc=(int*)calloc(1000,sizeof(int));    } } 

there might way block , or else user gets ssh access can crash system .

you can set various memory limits.

ulimit springs mind. can set shell (see http://unixhelp.ed.ac.uk/cgi/man-cgi?ulimit). there way of setting them system wide. there file stores these off top of head cannot remember located. need google it.


Comments

Popular posts from this blog

How to mention the localhost in android -

php - Calling a template part from a post -