MuntashirAkon/AppManager · error

Out of memory\n

Error message

Out of memory\n

What it means

malloc of the exec_argv array failed in main() while assembling the argument vector for execv of app_process. This is a standard out-of-memory sentinel check: the process cannot build the child command line without the allocation, so it unlinks the copied am.jar and returns failure to the caller.

Solutions

  1. Free existing buffers and retry the launch when memory pressure subsides
  2. Reduce exec_argc by limiting forwarded extra arguments
  3. Check device memory state before spawning the server process
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at app/src/main/cpp/run_server.c:208 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of MuntashirAkon/AppManager@0152f468fc (2026-09-12). Data as JSON: /api/errors/43dc30807678ee82. Report an issue: GitHub.

Appendix: source

Thrown at app/src/main/cpp/run_server.c:208

        unlink(exec_jar_path);
        return 1;
    }

    printf("Resolved Jar path: %s\n", resolved_am_jar_path);
    printf("Args: %s\n", args_buf);

    // Execute app_process
    if (setenv("CLASSPATH", exec_jar_path, 1) != 0) {
        fprintf(stderr, "Error setting CLASSPATH\n");
        unlink(exec_jar_path);
        return 1;
    }

    int extra_args_count = argc - 8;
    int exec_argc = 6 + extra_args_count;
    char **exec_argv = malloc(sizeof(char *) * exec_argc);
    if (!exec_argv) {
        fprintf(stderr, "Out of memory\n");
        unlink(exec_jar_path);
        return 1;
    }

    exec_argv[0] = "app_process";
    exec_argv[1] = "/system/bin";

    char nice_name_buf[128];
    snprintf(nice_name_buf, sizeof(nice_name_buf), "--nice-name=%s", SERVER_NAME);
    exec_argv[2] = nice_name_buf;

    exec_argv[3] = JAR_MAIN_CLASS;
    exec_argv[4] = args_buf;

    for (int i = 0; i < extra_args_count; i++) {
        exec_argv[5 + i] = argv[8 + i];
    }
    exec_argv[exec_argc - 1] = NULL;

View on GitHub (pinned to 0152f468fc)