Please let me know if there is some test appliaction available in
android repository. (CTS or some where)
I am pasting the code of sample test application below.
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include <unistd.h>
int main()
{
int size,i=0;
int **ptr = NULL;
int pid[6];
pid_t my_pid = (pid_t) 0;
char cmdStr[40];
memset(cmdStr, 0, 40);
unsigned long adbd_pid = 0;
ptr = (int **)malloc(2000000*sizeof(int *));//Pointer to hold 2M
Another pointer
int free_levels[6] = {1536,2048,4096,5120,5632,6144}; //
//Overwriting the default lowmemorykiller module parameters
system("cat /sys/module/lowmemorykiller/parameters/minfree");
system("echo 1536,2048,4096,5120,5632,6144 >/sys/module/
lowmemorykiller/parameters/minfree");
system("cat /sys/module/lowmemorykiller/parameters/minfree");
system("cat /proc/sys/vm/min_free_kbytes");
my_pid = getpid();
sprintf(cmdStr, "echo 13 > /proc/%d/oom_adj", my_pid);
system(cmdStr);
while(i++ < 240) //240 MB Memory
{
size = 256*1024*sizeof(int); //1MB
ptr[i] = (int *)malloc(size);
int *write=ptr[i];
if(ptr[i]!=NULL)
{
size = size/sizeof(int);
//printf("Success in malloc");
while(size--)
*write++=size;
system("/usr/bin/free");
}
else
{
printf("malloc error %d ",ptr[i]);
}
}
}
On Nov 23, 5:45 pm, Raja Pavan <
rajain...@gmail.com> wrote:
> We are trying to test Android LowMemoryKiller Driver using a sample
> test application.
>
> /sys/module/lowmemorykiller/parameters/adj 0,1,2,7,14,15
>
> MINFREE module parameter is set from the application.
>
> echo 1536,2048,4096,5120,5632,6144 >/sys/module/lowmemorykiller/
> parameters/minfree
>
> The test application is pasted at the end of this mail. (lowmemTest.c)
>
> Expected Behavior: We have set the oom_adj of the lowmemTest.c to 13.
> It is expected to get killed when the freememoryin the system (as
> seen from the putput of free() command is 5120*4*1024 = 20MB .
>
> We are printing the free memoy of the system by invoking free() inside
> the lowmemoryTest.c
>
> Observed Behavior:
> (1) But the process is not being killed at the 20MB freememory.
> (2) This process is getting killed at the freememoryclose to the
> min_free_kbytes (/proc/sys/vm/min_free_kbytes)
>
> Need Support on these Isssues (Any Patch to kernel)
>
> (1) Is there any patch to the linux 2.6.30 kernel (MM or some other
> subsystem) for getting the desired behavior from lowmemorykiller
> driver.
> (2) We have taken the lowmemorykillerfor this kernel from android