fa1f934f11310e83ff9d9233f0ad417898138b58
[platform/upstream/gstreamer.git] / tests / old / testsuite / refcounting / mem.c
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <string.h>
4 #include <fcntl.h>
5 #include <unistd.h>
6
7 int vmsize() {
8   int pid,fd,size,i,mem;
9   char filename[17], buf[256], *ptr, *end;
10
11   pid = getpid();
12   snprintf(filename,17,"/proc/%d/stat",pid);
13   fd = open(filename,O_RDONLY);
14   size = read(fd,buf,240);
15   ptr = buf;
16   for (i=0;i<22;i++)
17     ptr = (char *)strchr(ptr,' ') + 1;
18   end = (char *)strchr(ptr,' ');
19   *end = 0;
20   sscanf(ptr,"%d",&mem);
21   close(fd);
22   return mem;
23 }