# C API: Host services: memory, jobs, logging

`sona_allocator` holds `alloc(user, size, align)`, `free(user, ptr, size)` and `user`. `alloc` returns NULL on failure. All zero means `malloc` and `free`.

`sona_budget` is the memory budget in bytes. Zero fields take the defaults. Caches evict idle entries, oldest first, to stay inside their share; if what is live does not fit, the avatar that needed more fails with `SONA_E_LIMIT`.

| Field | Default |
|---|---|
| `total` | 0: no overall cap. Xbox 360 hosts should set it |
| `assets` | 256 MiB of decoded items |
| `clips` | 32 MiB of retained clip blocks |
| `faces` | 64 MiB of baked face sheets, at most 512 sheets, as the web |
| `source_cache` | 64 MiB of fetched container bytes, in memory only |
| `gpu_idle` | 64 MiB of GPU objects no avatar uses any more, as the web |

`sona_jobs` is a host job system: `{user, workers, run(user, fn, arg)}`. `run` runs `fn(arg)` once, on any thread; `workers` says how many run at once. The core hands it independent jobs (decode, face bake, build, skinning slices) and never waits on one inside a call that must not block.

Log levels are `SONA_LOG_ERROR` (0), `SONA_LOG_WARN`, `SONA_LOG_INFO` and `SONA_LOG_DEBUG` (3), passed to `sona_config.log`.
