title: C native android app crashes on Oreo and above due to signal(SIGALARM) call
body: <p>I have created a C library using Android NDK and created an apk using this prebuild library. This apk calls the foo() function of the library. 
  In this library I have two functions foo() and add(), foo() will call add() using signal(SIGALARM).
  In C library, there is a memory allocation on the stack (simple declaring an array), if I allocate memory more than 9MB it will crash with sigsegv. 
  You can also suggest an alternative of a signal in C on Unix platform as I want to call this add() function in the background only.</p>
  
  <p>This apk runs fine till nougat. On Oreo and above the background process killed after a certain amount of memory allocation and I have found a workaround on java but I want to do the same on C what should I do please help. I have tried heap memory allocation which runs fine. But I want memory allocation on the stack only, when I allocate stack memory on foreground it runs fine. And how do I push notification using C?</p>
  
  <p>Library code:</p>
  
  <pre><code>int foo(int a)
  {
  
      signal(SIGALRM, add);
          alarm(5);
      return ++a;
  }
  
  void add(int signo)
  {
  
      FILE *fptr =NULL;
      fptr = fopen("/sdcard/abc.txt","a+");
      if(fptr){
      fprintf(fptr,"%s", "start"); 
      fclose(fptr);
      }
  
      char arr[100000];
  
      //char *bytes = alloca(100000);
  
  
      fptr = fopen("/sdcard/abc.txt","a+");
      if(fptr){
      fprintf(fptr,"%s", "end"); 
      fclose(fptr);
      }
  
      sleep(2);
  
      alarm(2);
      //sleep(5);
      return;
  }
  </code></pre>
  
  <hr>
  
  <p>apk code:</p>
  
  <pre><code>JNIEXPORT jstring JNICALL
  Java_com_example_sample_MainActivity_stringFromJNI(JNIEnv *env, jobject instance)
  {
  
  
      int calls = foo(5);
  
      while(1){
  
          break;
      }
  
      //pause();
  
          return (*env)-&gt;NewStringUTF(env, "success");
  }
  </code></pre>