apple/pkl · error

failed to allocate pkl_exec_t

Error message

failed to allocate pkl_exec_t

What it means

Allocation check in pkl_init: calloc for the pkl_exec_t handle returned NULL (out of memory), so initialization cannot proceed and the process aborts. Input at fault: none — this is a sentinel allocation-failure path during library initialization.

Solutions

  1. Free memory or reduce process memory pressure before initializing libpkl.
  2. Check ulimit/cgroup memory limits for the embedding process.
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at libpkl/src/main/c/pkl.c:140 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of apple/pkl@f3efcbfc9b (2026-09-08). Data as JSON: /api/errors/024b632df169ca2e. Report an issue: GitHub.

Appendix: source

Thrown at libpkl/src/main/c/pkl.c:140

}

int pkl_init(pkl_message_response_handler handler, void *userData,
		pkl_exec_t **exec, pkl_error_t *error) {
	if (handler == NULL) {
		if (error != NULL) {
			error->message = "handler is null";
		}
		return -1;
	}
	if (exec == NULL) {
		if (error != NULL) {
			error->message = "exec is null";
		}
		return -1;
	}
	pkl_exec_t *pexec = calloc(1, sizeof(pkl_exec_t));
	if (pexec == NULL) {
		fprintf(stderr, "failed to allocate pkl_exec_t\n");
		abort();
	}

	pexec->handler = handler;
	pexec->userData = userData;

	graal_isolate_t *isolate;
	graal_isolatethread_t *isolateThread;

	if (graal_create_isolate(NULL, &isolate, &isolateThread) != 0) {
		if (error != NULL) {
			error->message = "Failed to create graal isolate thread";
		}
		free(pexec);
		*exec = NULL;
		return -1;
	}
	pexec->isolate = isolate;

View on GitHub (pinned to f3efcbfc9b)