How-to guides

Native dependencies

The native libraries of a NuGet package (runtimes/<rid>/native/) go into the package's server/ folder with their relative path, and the Komod's load context loads the one that matches the running platform (DllImport).

Size: KomodRuntimeIdentifiers

By default the native files of all platforms are included. In Package.props you can limit them:

<KomodRuntimeIdentifiers>linux-arm64;linux-x64;win-x64</KomodRuntimeIdentifiers>

Only the listed RIDs go into the package. With a large native dependency this matters a lot (ONNX Runtime with all platforms is about 250 MB).

Unloading

Native code cannot be unloaded: it stays in the process after the package is unloaded. The package can still be reloaded, but the memory is freed only when the server restarts; with many reloads it accumulates.

External process

If the task does not fit into the .NET process (Python, a Coral TPU), the Komod can start and supervise an external process and communicate with it over a local channel. Such a Komod looks like any other in the graph.