Find memory leaks and runaway peak usage in stateful UDFs with memray, before they cause worker OOMs in production.
Stateful UDFs are the most common source of worker memory pressure in Geneva. Unlike scalar UDFs, a stateful UDF instance lives for the entire lifetime of a Ray actor, processing many batches in sequence. Anything your setup() allocates is held for the duration of the job, and anything __call__ retains accumulates batch after batch — sometimes silently, until a worker OOMs partway through a large backfill.This page shows you how to profile a stateful UDF locally with memray, what to look for, and the common patterns that leak.
If your worker is being OOM-killed and you don’t know why, profile a single actor locally first. A 5-minute memray run on your laptop is faster than another 45-minute distributed run that fails the same way.
@geneva.udf(data_type=pa.list_(pa.float32(), 512))class MyEmbedding: def __init__(self): self.model = None def setup(self): self.model = load_model() # allocated once per actor def __call__(self, text: str) -> list[float]: if self.model is None: self.setup() return self.model.embed(text)
A few facts make memory behavior easy to get wrong:
One instance per worker, many batches. Geneva instantiates the class once per Ray actor. The same self processes every batch routed to that worker — potentially thousands.
setup() runs once. Whatever you allocate there stays in memory until the actor dies. That’s intentional for things like ML models, but it’s a footgun for “lazy” caches that grow.
self.<attr> survives across calls. Anything you attach to self inside __call__ is retained for the rest of the actor’s life.
Workers don’t restart between batches. Unlike a serverless function, you don’t get a fresh process per invocation. Memory accumulates linearly with batch count until the worker hits its memory cap.
The result: a leak that looks tiny in unit tests (1 batch, 4 MiB) can blow up an 8-hour backfill (10 000 batches, 40 GiB).
memray ships as a dev dependency in Geneva, so it’s already in your environment if you installed with uv sync.The trick to profiling under Ray is that workers run in separate processes. Wrapping pytest with memray run only sees the driver, not the actors that actually run your UDF. The cleanest pattern is to have the UDF instrument itself, controlled by an environment variable that’s only set when you want a profile.
Ray workers don’t inherit driver environment variables by default. When you start a local Ray cluster from Geneva, pass extra_env so the variable reaches each worker:
from geneva.runners.ray._mgr import ray_clusterwith ray_cluster( local=True, extra_env={"MY_UDF_MEMRAY_OUT_DIR": "/tmp/my-udf-profile"},): table.backfill("embedding", concurrency=1)
Set concurrency=1 while profiling. One actor processing all batches sequentially produces a single clean trace; the default of 8 produces 8 noisier traces that you’d have to merge mentally.
When backfill finishes, you’ll have one (or more) memray-<pid>-<uuid>.bin files under /tmp/my-udf-profile/. Render and inspect them:
# Quick summary — peak heap, total allocations, what's leakeduv run -m memray summary /tmp/my-udf-profile/memray-*.bin# Interactive flamegraph in your browseruv run -m memray flamegraph /tmp/my-udf-profile/memray-*.binopen /tmp/my-udf-profile/memray-*.html# Top allocators by retained bytesuv run -m memray tree /tmp/my-udf-profile/memray-*.bin
Peak heap (metadata.peak_memory) — the high-water mark. This is what triggers OOMs. A peak well above your setup() allocations means a batch transiently doubles memory before freeing.
Leaked allocations (get_leaked_allocation_records()) — what was still allocated when the tracker ended. This is not necessarily a bug — your setup() model is “leaked” in this sense because it lives the actor’s lifetime. The signal is how much above expected baseline is leaked.
A healthy stateful UDF profile, after processing many batches, looks roughly like:
peak heap ≈ setup() allocations + 1 batch of working memoryleaked ≈ setup() allocations (i.e. nothing extra retained from __call__)
An unhealthy profile looks like:
peak heap ≈ setup() + N × per-call allocation ← grows with batch countleaked ≈ setup() + N × per-call allocation ← per-call state never freed
The flamegraph will show a thick stack frame anchored in __call__ rising as you scroll through time — that’s the leak.
memray gives you the Python-side allocation story. For real diagnosis of “where is the worker’s memory actually going?”, it pays to watch process RSS and Arrow’s own allocator side-by-side — together they tell you which subsystem owns the bytes, often faster than reading a flamegraph.Drop this into your UDF (or anywhere on the worker) to log a snapshot:
rss_mb — every byte the OS has handed this Python interpreter. Includes Python heap, Arrow, native libraries, and pages the C allocator (glibc/jemalloc) is holding even though Python freed them. This is what triggers cgroup OOM-kills.
arrow_live_mb — bytes currently held by live PyArrow buffers (RecordBatch, Array, ChunkedArray, etc.). Goes up when you create Arrow data, down when those references are dropped.
gap_mb = rss − arrow_live — “everything else.” This is the Python heap (your own self.cache, model weights, dicts, lists), native libraries (PyTorch, ONNX), and allocator retention.
Log the breakdown every few batches and the shape of growth over time tells you which subsystem to fix:
Pattern
Diagnosis
First thing to try
rss climbs slowly, arrow_live flat near zero, big growing gap
Allocator retention — Python freed it but glibc is keeping the pages
ctypes.CDLL("libc.so.6").malloc_trim(0) periodically (Linux only); or set MALLOC_TRIM_THRESHOLD_=131072
rss climbs, arrow_live climbs in lockstep
Real Arrow leak — your code is holding RecordBatch / Array references
Find where you’re appending batches to self, or where checkpoint / error payloads aren’t being released
rss spikes hugely on a few calls then settles, eventually one spike OOMs
Peak is too big, not a leak — a single call allocates more than the worker has
Shrink batch_size, blob_read_buffer_size, or split the work
rss flat for hours then sudden cliff upward
One pathological row — usually one huge blob (a 4K-resolution image, a 50 MB PDF)
Find the offending row by ID; add a size check at the top of __call__
rss rises during setup(), then flat for the whole run, gap constant
Healthy — that’s your model loaded once per actor
Nothing to do
The reference UDFs in Geneva’s own integration test (src/stress_tests/_memray_probe.py) print exactly this breakdown every 32 calls. The workflow’s stdout logs are a working example of the “clean” and “leaky” patterns — the leaky one shows the lockstep with Python heap signature (the second row above, but with gap climbing instead of arrow_live — because the leak is bytearray, not Arrow).
class BadEmbedding: def __init__(self): self.cache: dict[str, list[float]] = {} def __call__(self, text: str) -> list[float]: if text not in self.cache: self.cache[text] = self.model.embed(text) return self.cache[text]
Looks harmless. Fine on a unit test with 10 inputs. Catastrophic on a backfill of 10M rows, where most inputs are unique and the cache grows to fill the worker.Fix: Use a bounded cache (functools.lru_cache with maxsize, or a manual size cap), or skip caching when you don’t know the cardinality.
from functools import lru_cacheclass GoodEmbedding: def __init__(self): self._embed = None def setup(self): model = load_model() self._embed = lru_cache(maxsize=1024)(model.embed) def __call__(self, text: str) -> list[float]: if self._embed is None: self.setup() return self._embed(text)
Fix: Don’t hold references to inputs past the return of __call__. If you need rolling state, summarize into a small aggregate (counts, sums) instead of holding the raw batches.
For Hugging Face pipelines, ensure you’re in eval() mode and not accumulating gradients. For long-running stateful UDFs on GPUs, also see torch.cuda.empty_cache() between large batches.
If memray summary doesn’t show leaked bytes growing roughly with batch count after this change, your tracker isn’t actually attached (most often: the env var isn’t reaching workers — re-check extra_env).Geneva’s own test suite ships a reference implementation of this pattern in src/stress_tests/_memray_probe.py and src/stress_tests/test_memray_stateful_udf.py, plus a GitHub Actions workflow (memray-stateful-udf-profile.yml) that uploads the per-actor .bin and rendered flamegraph as a CI artifact. Feel free to copy that scaffolding for your own project’s UDFs.
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"LanceDB","colors":{"primary":"#FF6B35","light":"#FF8A5C","dark":"#E55A2B"},"logo":{"light":"https://mintcdn.com/lancedb-bcbb4faf/6L0IRVkfdlgMU1Pw/static/assets/logo/dark-lancedb-logo.svg?fit=max\u0026auto=format\u0026n=6L0IRVkfdlgMU1Pw\u0026q=85\u0026s=d0592e59a29df2477080a857e13e341f","dark":"https://mintcdn.com/lancedb-bcbb4faf/t0AGunBr6LulGkIJ/static/assets/logo/light-lancedb-logo.svg?fit=max\u0026auto=format\u0026n=t0AGunBr6LulGkIJ\u0026q=85\u0026s=9b508fcb8d83cbc9bd05e57227d739e9","href":"https://lancedb.com"},"favicon":"https://mintcdn.com/lancedb-bcbb4faf/0sS6vrpmM3KSVyss/static/favicon.ico?fit=max\u0026auto=format\u0026n=0sS6vrpmM3KSVyss\u0026q=85\u0026s=84b9ea3dfc312b7a4dfc99219e229b33","appearance":{"strict":false},"background":{"color":{"light":"#FAF5F0","dark":"#000000"}},"navbar":{"links":[{"href":"https://www.lancedb.com/contact","label":"Support"}]},"footer":{"socials":{"github":"https://github.com/lancedb","linkedin":"https://www.linkedin.com/company/lancedb","x":"https://x.com/lancedb","discord":"https://discord.gg/AUEWnJ7Txb"},"links":[{"items":[{"label":"Cookie settings","href":"#cookie-settings"}]}]},"fonts":{"family":"Inter"},"styling":{"codeblocks":{"theme":{"light":"vitesse-light","dark":"catppuccin-mocha"}},"latex":true},"integrations":{"ga4":{"measurementId":"G-1TMC2PR69E"}},"banner":{"content":"[From the Reverie stage to your screen. Recordings coming soon.](https://www.reveriesummit.com/?utm_campaign=reverie-2026\u0026utm_content=docs\u0026utm_medium=lancedb\u0026utm_source=banner)","dismissible":true},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"lancedb-bcbb4faf","hasAudioNarration":false,"actualSubdomain":"lancedb-bcbb4faf","customDomains":["docs.lancedb.com"],"gitSource":{"type":"github","owner":"lancedb","repo":"docs","deployBranch":"assembled","contentDirectory":"docs","isPrivate":true,"mountPath":"","label":"","_id":"6af512fe0902081a53d8698c"},"feedback":{"thumbs":true,"edits":false,"issues":false},"entitlements":{"AI_CHAT":{"status":"ENABLED"},"WEB_MCP":{"status":"ENABLED"},"NARRATION":{"status":"ENABLED"}},"buildId":"6af512fe0902081a53d86992","clientVersion":"0.0.4111","searchFilterCounts":[{"language":"default","tag":"Documentation","count":366},{"language":"default","tag":"Enterprise","count":340},{"language":"default","tag":"Embedded","count":340},{"language":"default","tag":"API Reference","count":110},{"language":"default","tag":"REST API","count":110},{"language":"default","tag":"Feature Engineering","count":90},{"language":"default","tag":"Table","count":88},{"language":"default","tag":"Integrations","count":84},{"language":"default","tag":"SQL Reference","count":80},{"language":"default","tag":"Geneva","count":68}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableAskAiSearchBar":true},"basePath":"","hasChatPermissions":true,"hasWebMcpPermissions":true,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-rbac-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[{"filePath":"static/styles/style.css","content":":root{--banner-left: #e4d8f8;--banner-right: #e55a2b}@font-face{font-family:\"LanceDB KaTeX AMS\";src:url(\"https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/fonts/KaTeX_AMS-Regular.woff2\") format(\"woff2\");font-display:swap;font-style:normal;font-weight:400}.katex .mathbb,.katex .textbb{font-family:\"LanceDB KaTeX AMS\", \"KaTeX_AMS\", serif!important}#banner,:where(.banner,[data-banner],[class*=\"Banner_banner\"]){background:linear-gradient(90deg, var(--banner-left) 0%, var(--banner-right) 100%)!important;color:#1b0f09!important;border:none!important}#banner a,:where(.banner,[data-banner],[class*=\"Banner_banner\"]) a{color:#1b0f09!important;font-size:0.9rem;font-weight:500;text-decoration-color:rgba(27, 15, 9, 0.35)}#banner button,:where(.banner,[data-banner],[class*=\"Banner_banner\"]) button{color:#1b0f09!important}"}],"page":{"pagePath":"oss/v0-41-0/geneva/udfs/profiling-memory","slug":"/oss/v0-41-0/geneva/udfs/profiling-memory","pageMetadata":{"title":"Profiling Stateful UDF Memory","sidebarTitle":"Profiling Memory","description":"Find memory leaks and runaway peak usage in stateful UDFs with memray, before they cause worker OOMs in production.","icon":"chart-line","href":"/oss/v0-41-0/geneva/udfs/profiling-memory"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Find memory leaks and runaway peak usage in stateful UDFs with memray, before they cause worker OOMs in production.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,em:`em`,li:`li`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,tbody:`tbody`,td:`td`,th:`th`,thead:`thead`,tr:`tr`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,CodeGroup,Heading,Table,Tip}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!CodeGroup)_missingMdxReference(`CodeGroup`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Table)_missingMdxReference(`Table`,true);if(!Tip)_missingMdxReference(`Tip`,true);return _jsxs(_Fragment,{children:[_jsxs(_components.p,{children:[`Stateful UDFs are the most common source of worker memory pressure in Geneva. Unlike scalar UDFs, a stateful UDF instance lives for the `,_jsx(_components.strong,{children:`entire lifetime of a Ray actor`}),`, processing many batches in sequence. Anything your `,_jsx(_components.code,{children:`setup()`}),` allocates is held for the duration of the job, and anything `,_jsx(_components.code,{children:`__call__`}),` retains accumulates batch after batch — sometimes silently, until a worker OOMs partway through a large backfill.`]}),`\n`,_jsxs(_components.p,{children:[`This page shows you how to profile a stateful UDF locally with `,_jsx(_components.a,{href:`https://github.com/bloomberg/memray`,children:`memray`}),`, what to look for, and the common patterns that leak.`]}),`\n`,_jsx(Tip,{children:_jsxs(_components.p,{children:[`If your worker is being OOM-killed and you don’t know why, `,_jsx(_components.strong,{children:`profile a single actor locally first`}),`. A 5-minute memray run on your laptop is faster than another 45-minute distributed run that fails the same way.`]})}),`\n`,_jsx(Heading,{level:`2`,id:`why-stateful-udfs-leak`,children:`Why stateful UDFs leak`}),`\n`,_jsx(_components.p,{children:`A stateful UDF in Geneva is a class:`}),`\n`,_jsx(CodeGroup,{children:_jsx(CodeBlock,{filename:`Python`,icon:`python`,numberOfLines:`12`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes vitesse-light catppuccin-mocha`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#1e1e2e`,color:`#393a34`,\"--shiki-dark\":`#cdd6f4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`12`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#999999`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#FAB387`,\"--shiki-dark-font-style\":`italic`},children:`@`}),_jsx(_components.span,{style:{color:`#59873A`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#FAB387`,\"--shiki-dark-font-style\":`italic`},children:`geneva`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`.`}),_jsx(_components.span,{style:{color:`#59873A`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#FAB387`,\"--shiki-dark-font-style\":`italic`},children:`udf`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`(`}),_jsx(_components.span,{style:{color:`#B07D48`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#EBA0AC`,\"--shiki-dark-font-style\":`italic`},children:`data_type`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#94E2D5`},children:`=`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:`pa`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`.`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#89B4FA`},children:`list_`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`(`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:`pa`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`.`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#89B4FA`},children:`float32`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`(),`}),_jsx(_components.span,{style:{color:`#2F798A`,\"--shiki-dark\":`#FAB387`},children:` 512`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`))`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#AB5959`,\"--shiki-dark\":`#CBA6F7`},children:`class`}),_jsx(_components.span,{style:{color:`#2E8F82`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#F9E2AF`,\"--shiki-dark-font-style\":`italic`},children:` MyEmbedding`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#AB5959`,\"--shiki-dark\":`#CBA6F7`},children:` def`}),_jsx(_components.span,{style:{color:`#998418`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#89DCEB`,\"--shiki-dark-font-style\":`italic`},children:` __init__`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`(`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#F38BA8`,\"--shiki-dark-font-style\":`italic`},children:`self`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`):`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#A65E2B`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#F38BA8`,\"--shiki-dark-font-style\":`italic`},children:` self`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`.`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:`model `}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#94E2D5`},children:`=`}),_jsx(_components.span,{style:{color:`#1E754F`,\"--shiki-dark\":`#FAB387`},children:` None`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#AB5959`,\"--shiki-dark\":`#CBA6F7`},children:` def`}),_jsx(_components.span,{style:{color:`#59873A`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#89B4FA`,\"--shiki-dark-font-style\":`italic`},children:` setup`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`(`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#F38BA8`,\"--shiki-dark-font-style\":`italic`},children:`self`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`):`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#A65E2B`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#F38BA8`,\"--shiki-dark-font-style\":`italic`},children:` self`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`.`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:`model `}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#94E2D5`},children:`=`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#89B4FA`},children:` load_model`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`()`}),_jsx(_components.span,{style:{color:`#A0ADA0`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#9399B2`,\"--shiki-dark-font-style\":`italic`},children:` # allocated once per actor`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#AB5959`,\"--shiki-dark\":`#CBA6F7`},children:` def`}),_jsx(_components.span,{style:{color:`#998418`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#89DCEB`,\"--shiki-dark-font-style\":`italic`},children:` __call__`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`(`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#F38BA8`,\"--shiki-dark-font-style\":`italic`},children:`self`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`,`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#EBA0AC`,\"--shiki-dark-font-style\":`italic`},children:` text`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`:`}),_jsx(_components.span,{style:{color:`#998418`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#CBA6F7`,\"--shiki-dark-font-style\":`italic`},children:` str`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`)`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:` ->`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#EBA0AC`,\"--shiki-dark-font-style\":`italic`},children:` list`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`[`}),_jsx(_components.span,{style:{color:`#998418`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#CBA6F7`,\"--shiki-dark-font-style\":`italic`},children:`float`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`]:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1E754F`,\"--shiki-dark\":`#CBA6F7`},children:` if`}),_jsx(_components.span,{style:{color:`#A65E2B`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#F38BA8`,\"--shiki-dark-font-style\":`italic`},children:` self`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`.`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:`model `}),_jsx(_components.span,{style:{color:`#AB5959`,\"--shiki-dark\":`#CBA6F7`},children:`is`}),_jsx(_components.span,{style:{color:`#1E754F`,\"--shiki-dark\":`#FAB387`},children:` None`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#A65E2B`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#F38BA8`,\"--shiki-dark-font-style\":`italic`},children:` self`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`.`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#89B4FA`},children:`setup`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`()`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1E754F`,\"--shiki-dark\":`#CBA6F7`},children:` return`}),_jsx(_components.span,{style:{color:`#A65E2B`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#F38BA8`,\"--shiki-dark-font-style\":`italic`},children:` self`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`.`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:`model`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`.`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#89B4FA`},children:`embed`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`(`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:`text`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`)`})]}),`\n`]})})})}),`\n`,_jsx(_components.p,{children:`A few facts make memory behavior easy to get wrong:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`One instance per worker, many batches.`}),` Geneva instantiates the class once per Ray actor. The same `,_jsx(_components.code,{children:`self`}),` processes every batch routed to that worker — potentially thousands.`]}),`\n`,_jsxs(_components.li,{children:[_jsxs(_components.strong,{children:[_jsx(_components.code,{children:`setup()`}),` runs once.`]}),` Whatever you allocate there stays in memory until the actor dies. That’s intentional for things like ML models, but it’s a footgun for “lazy” caches that grow.`]}),`\n`,_jsxs(_components.li,{children:[_jsxs(_components.strong,{children:[_jsx(_components.code,{children:`self.\u003cattr>`}),` survives across calls.`]}),` Anything you attach to `,_jsx(_components.code,{children:`self`}),` inside `,_jsx(_components.code,{children:`__call__`}),` is retained for the rest of the actor’s life.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Workers don’t restart between batches.`}),` Unlike a serverless function, you don’t get a fresh process per invocation. Memory accumulates linearly with batch count until the worker hits its memory cap.`]}),`\n`]}),`\n`,_jsx(_components.p,{children:`The result: a leak that looks tiny in unit tests (1 batch, 4 MiB) can blow up an 8-hour backfill (10 000 batches, 40 GiB).`}),`\n`,_jsx(Heading,{level:`2`,id:`when-to-profile`,children:`When to profile`}),`\n`,_jsxs(_components.p,{children:[`Profile your UDF if `,_jsx(_components.strong,{children:`any`}),` of these are true:`]}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`The UDF loads a model, builds an index, or otherwise allocates more than ~100 MiB in `,_jsx(_components.code,{children:`setup()`}),`.`]}),`\n`,_jsxs(_components.li,{children:[`The UDF maintains a cache, deduplication table, or running statistic in `,_jsx(_components.code,{children:`self`}),`.`]}),`\n`,_jsxs(_components.li,{children:[`A worker is being OOM-killed during backfill (look for `,_jsx(_components.code,{children:`FatalWorkerOOMError`}),`, see `,_jsx(_components.a,{href:`/oss/v0-41-0/geneva/jobs/troubleshooting`,children:`Job troubleshooting`}),`).`]}),`\n`,_jsxs(_components.li,{children:[`Worker RSS grows steadily during a backfill rather than staying flat after `,_jsx(_components.code,{children:`setup()`}),`.`]}),`\n`]}),`\n`,_jsxs(_components.p,{children:[`You do `,_jsx(_components.strong,{children:`not`}),` need to profile pure functional UDFs (no `,_jsx(_components.code,{children:`self`}),` state) or UDFs that only ever read from `,_jsx(_components.code,{children:`self`}),` — those can’t leak by construction.`]}),`\n`,_jsx(Heading,{level:`2`,id:`profiling-a-udf-with-memray`,children:`Profiling a UDF with memray`}),`\n`,_jsxs(_components.p,{children:[`memray ships as a `,_jsx(_components.code,{children:`dev`}),` dependency in Geneva, so it’s already in your environment if you installed with `,_jsx(_components.code,{children:`uv sync`}),`.`]}),`\n`,_jsxs(_components.p,{children:[`The trick to profiling under Ray is that `,_jsx(_components.strong,{children:`workers run in separate processes`}),`. Wrapping `,_jsx(_components.code,{children:`pytest`}),` with `,_jsx(_components.code,{children:`memray run`}),` only sees the driver, not the actors that actually run your UDF. The cleanest pattern is to have `,_jsx(_components.strong,{children:`the UDF instrument itself`}),`, controlled by an environment variable that’s only set when you want a profile.`]}),`\n`,_jsx(Heading,{level:`3`,id:`step-1-—-add-an-opt-in-tracker-to-your-udf`,children:`Step 1 — add an opt-in tracker to your UDF`}),`\n`,_jsx(CodeGroup,{children:_jsx(CodeBlock,{filename:`Python`,icon:`python`,numberOfLines:`34`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes vitesse-light catppuccin-mocha`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#1e1e2e`,color:`#393a34`,\"--shiki-dark\":`#cdd6f4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`34`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1E754F`,\"--shiki-dark\":`#CBA6F7`},children:`import`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:` os`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`,`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:` pathlib`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`,`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:` uuid`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1E754F`,\"--shiki-dark\":`#CBA6F7`},children:`from`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:` typing `}),_jsx(_components.span,{style:{color:`#1E754F`,\"--shiki-dark\":`#CBA6F7`},children:`import`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:` Any`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1E754F`,\"--shiki-dark\":`#CBA6F7`},children:`import`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:` memray`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1E754F`,\"--shiki-dark\":`#CBA6F7`},children:`import`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:` geneva`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1E754F`,\"--shiki-dark\":`#CBA6F7`},children:`import`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:` pyarrow `}),_jsx(_components.span,{style:{color:`#1E754F`,\"--shiki-dark\":`#CBA6F7`},children:`as`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:` pa`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#A65E2B`,\"--shiki-dark\":`#CDD6F4`},children:`_MEMRAY_OUT_DIR_ENV`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#94E2D5`},children:` =`}),_jsx(_components.span,{style:{color:`#B5695977`,\"--shiki-dark\":`#A6E3A1`},children:` \"`}),_jsx(_components.span,{style:{color:`#B56959`,\"--shiki-dark\":`#A6E3A1`},children:`MY_UDF_MEMRAY_OUT_DIR`}),_jsx(_components.span,{style:{color:`#B5695977`,\"--shiki-dark\":`#A6E3A1`},children:`\"`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#999999`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#FAB387`,\"--shiki-dark-font-style\":`italic`},children:`@`}),_jsx(_components.span,{style:{color:`#59873A`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#FAB387`,\"--shiki-dark-font-style\":`italic`},children:`geneva`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`.`}),_jsx(_components.span,{style:{color:`#59873A`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#FAB387`,\"--shiki-dark-font-style\":`italic`},children:`udf`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`(`}),_jsx(_components.span,{style:{color:`#B07D48`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#EBA0AC`,\"--shiki-dark-font-style\":`italic`},children:`data_type`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#94E2D5`},children:`=`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:`pa`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`.`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#89B4FA`},children:`list_`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`(`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:`pa`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`.`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#89B4FA`},children:`float32`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`(),`}),_jsx(_components.span,{style:{color:`#2F798A`,\"--shiki-dark\":`#FAB387`},children:` 512`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`))`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#AB5959`,\"--shiki-dark\":`#CBA6F7`},children:`class`}),_jsx(_components.span,{style:{color:`#2E8F82`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#F9E2AF`,\"--shiki-dark-font-style\":`italic`},children:` MyEmbedding`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#AB5959`,\"--shiki-dark\":`#CBA6F7`},children:` def`}),_jsx(_components.span,{style:{color:`#998418`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#89DCEB`,\"--shiki-dark-font-style\":`italic`},children:` __init__`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`(`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#F38BA8`,\"--shiki-dark-font-style\":`italic`},children:`self`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`):`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#A65E2B`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#F38BA8`,\"--shiki-dark-font-style\":`italic`},children:` self`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`.`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:`model `}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#94E2D5`},children:`=`}),_jsx(_components.span,{style:{color:`#1E754F`,\"--shiki-dark\":`#FAB387`},children:` None`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#A65E2B`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#F38BA8`,\"--shiki-dark-font-style\":`italic`},children:` self`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`.`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:`_tracker`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`:`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:` Any `}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#94E2D5`},children:`=`}),_jsx(_components.span,{style:{color:`#1E754F`,\"--shiki-dark\":`#FAB387`},children:` None`}),_jsx(_components.span,{style:{color:`#A0ADA0`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#9399B2`,\"--shiki-dark-font-style\":`italic`},children:` # memray.Tracker, when profiling is on`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#AB5959`,\"--shiki-dark\":`#CBA6F7`},children:` def`}),_jsx(_components.span,{style:{color:`#59873A`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#89B4FA`,\"--shiki-dark-font-style\":`italic`},children:` setup`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`(`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#F38BA8`,\"--shiki-dark-font-style\":`italic`},children:`self`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`):`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#A0ADA0`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#9399B2`,\"--shiki-dark-font-style\":`italic`},children:` # Open a memray tracker per worker process, if requested. Each`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#A0ADA0`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#9399B2`,\"--shiki-dark-font-style\":`italic`},children:` # worker writes its own .bin file so traces don't collide.`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:` out_dir `}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#94E2D5`},children:`=`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:` os`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`.`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:`environ`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`.`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#89B4FA`},children:`get`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`(`}),_jsx(_components.span,{style:{color:`#A65E2B`,\"--shiki-dark\":`#CDD6F4`},children:`_MEMRAY_OUT_DIR_ENV`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1E754F`,\"--shiki-dark\":`#CBA6F7`},children:` if`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:` out_dir`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:` pathlib`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`.`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#89B4FA`},children:`Path`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`(`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:`out_dir`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`).`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#89B4FA`},children:`mkdir`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`(`}),_jsx(_components.span,{style:{color:`#B07D48`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#EBA0AC`,\"--shiki-dark-font-style\":`italic`},children:`parents`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#94E2D5`},children:`=`}),_jsx(_components.span,{style:{color:`#1E754F`,\"--shiki-dark\":`#FAB387`},children:`True`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`,`}),_jsx(_components.span,{style:{color:`#B07D48`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#EBA0AC`,\"--shiki-dark-font-style\":`italic`},children:` exist_ok`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#94E2D5`},children:`=`}),_jsx(_components.span,{style:{color:`#1E754F`,\"--shiki-dark\":`#FAB387`},children:`True`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:` bin_path `}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#94E2D5`},children:`=`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:` pathlib`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`.`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#89B4FA`},children:`Path`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`(`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:`out_dir`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`)`}),_jsx(_components.span,{style:{color:`#AB5959`,\"--shiki-dark\":`#94E2D5`},children:` /`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:` (`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#AB5959`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#A6E3A1`,\"--shiki-dark-font-style\":`italic`},children:` f`}),_jsx(_components.span,{style:{color:`#B56959`,\"--shiki-dark\":`#A6E3A1`},children:`\"memray-`}),_jsx(_components.span,{style:{color:`#A65E2B`,\"--shiki-dark\":`#F5C2E7`},children:`{`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:`os`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`.`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#89B4FA`},children:`getpid`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`()`}),_jsx(_components.span,{style:{color:`#A65E2B`,\"--shiki-dark\":`#F5C2E7`},children:`}`}),_jsx(_components.span,{style:{color:`#B56959`,\"--shiki-dark\":`#A6E3A1`},children:`-`}),_jsx(_components.span,{style:{color:`#A65E2B`,\"--shiki-dark\":`#F5C2E7`},children:`{`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:`uuid`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`.`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#89B4FA`},children:`uuid4`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`().`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:`hex`}),_jsx(_components.span,{style:{color:`#A65E2B`,\"--shiki-dark\":`#F5C2E7`},children:`}`}),_jsx(_components.span,{style:{color:`#B56959`,\"--shiki-dark\":`#A6E3A1`},children:`.bin\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:` )`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#A65E2B`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#F38BA8`,\"--shiki-dark-font-style\":`italic`},children:` self`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`.`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:`_tracker `}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#94E2D5`},children:`=`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:` memray`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`.`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#89B4FA`},children:`Tracker`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#998418`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#CBA6F7`,\"--shiki-dark-font-style\":`italic`},children:` str`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`(`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:`bin_path`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`),`}),_jsx(_components.span,{style:{color:`#B07D48`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#EBA0AC`,\"--shiki-dark-font-style\":`italic`},children:` native_traces`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#94E2D5`},children:`=`}),_jsx(_components.span,{style:{color:`#1E754F`,\"--shiki-dark\":`#FAB387`},children:`False`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`,`}),_jsx(_components.span,{style:{color:`#B07D48`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#EBA0AC`,\"--shiki-dark-font-style\":`italic`},children:` follow_fork`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#94E2D5`},children:`=`}),_jsx(_components.span,{style:{color:`#1E754F`,\"--shiki-dark\":`#FAB387`},children:`False`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:` )`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#A65E2B`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#F38BA8`,\"--shiki-dark-font-style\":`italic`},children:` self`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`.`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:`_tracker`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`.`}),_jsx(_components.span,{style:{color:`#998418`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#89DCEB`,\"--shiki-dark-font-style\":`italic`},children:`__enter__`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`()`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#A65E2B`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#F38BA8`,\"--shiki-dark-font-style\":`italic`},children:` self`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`.`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:`model `}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#94E2D5`},children:`=`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#89B4FA`},children:` load_model`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`()`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#AB5959`,\"--shiki-dark\":`#CBA6F7`},children:` def`}),_jsx(_components.span,{style:{color:`#998418`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#89DCEB`,\"--shiki-dark-font-style\":`italic`},children:` __call__`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`(`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#F38BA8`,\"--shiki-dark-font-style\":`italic`},children:`self`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`,`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#EBA0AC`,\"--shiki-dark-font-style\":`italic`},children:` text`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`:`}),_jsx(_components.span,{style:{color:`#998418`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#CBA6F7`,\"--shiki-dark-font-style\":`italic`},children:` str`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`)`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:` ->`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#EBA0AC`,\"--shiki-dark-font-style\":`italic`},children:` list`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`[`}),_jsx(_components.span,{style:{color:`#998418`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#CBA6F7`,\"--shiki-dark-font-style\":`italic`},children:`float`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`]:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1E754F`,\"--shiki-dark\":`#CBA6F7`},children:` if`}),_jsx(_components.span,{style:{color:`#A65E2B`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#F38BA8`,\"--shiki-dark-font-style\":`italic`},children:` self`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`.`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:`model `}),_jsx(_components.span,{style:{color:`#AB5959`,\"--shiki-dark\":`#CBA6F7`},children:`is`}),_jsx(_components.span,{style:{color:`#1E754F`,\"--shiki-dark\":`#FAB387`},children:` None`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#A65E2B`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#F38BA8`,\"--shiki-dark-font-style\":`italic`},children:` self`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`.`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#89B4FA`},children:`setup`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`()`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1E754F`,\"--shiki-dark\":`#CBA6F7`},children:` return`}),_jsx(_components.span,{style:{color:`#A65E2B`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#F38BA8`,\"--shiki-dark-font-style\":`italic`},children:` self`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`.`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:`model`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`.`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#89B4FA`},children:`embed`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`(`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:`text`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`)`})]}),`\n`]})})})}),`\n`,_jsxs(_components.p,{children:[`The tracker is a no-op when `,_jsx(_components.code,{children:`MY_UDF_MEMRAY_OUT_DIR`}),` isn’t set, so leaving this code in your UDF is safe for production runs.`]}),`\n`,_jsx(Heading,{level:`3`,id:`step-2-—-propagate-the-env-var-to-ray-workers`,children:`Step 2 — propagate the env var to Ray workers`}),`\n`,_jsxs(_components.p,{children:[`Ray workers don’t inherit driver environment variables by default. When you start a local Ray cluster from Geneva, pass `,_jsx(_components.code,{children:`extra_env`}),` so the variable reaches each worker:`]}),`\n`,_jsx(CodeGroup,{children:_jsx(CodeBlock,{filename:`Python`,icon:`python`,numberOfLines:`7`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes vitesse-light catppuccin-mocha`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#1e1e2e`,color:`#393a34`,\"--shiki-dark\":`#cdd6f4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`7`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1E754F`,\"--shiki-dark\":`#CBA6F7`},children:`from`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:` geneva`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`.`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:`runners`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`.`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:`ray`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`.`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:`_mgr `}),_jsx(_components.span,{style:{color:`#1E754F`,\"--shiki-dark\":`#CBA6F7`},children:`import`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:` ray_cluster`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1E754F`,\"--shiki-dark\":`#CBA6F7`},children:`with`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#89B4FA`},children:` ray_cluster`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#B07D48`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#EBA0AC`,\"--shiki-dark-font-style\":`italic`},children:` local`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#94E2D5`},children:`=`}),_jsx(_components.span,{style:{color:`#1E754F`,\"--shiki-dark\":`#FAB387`},children:`True`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#B07D48`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#EBA0AC`,\"--shiki-dark-font-style\":`italic`},children:` extra_env`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#94E2D5`},children:`=`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`{`}),_jsx(_components.span,{style:{color:`#B5695977`,\"--shiki-dark\":`#A6E3A1`},children:`\"`}),_jsx(_components.span,{style:{color:`#B56959`,\"--shiki-dark\":`#A6E3A1`},children:`MY_UDF_MEMRAY_OUT_DIR`}),_jsx(_components.span,{style:{color:`#B5695977`,\"--shiki-dark\":`#A6E3A1`},children:`\"`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`:`}),_jsx(_components.span,{style:{color:`#B5695977`,\"--shiki-dark\":`#A6E3A1`},children:` \"`}),_jsx(_components.span,{style:{color:`#B56959`,\"--shiki-dark\":`#A6E3A1`},children:`/tmp/my-udf-profile`}),_jsx(_components.span,{style:{color:`#B5695977`,\"--shiki-dark\":`#A6E3A1`},children:`\"`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`},`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`):`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:` table`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`.`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#89B4FA`},children:`backfill`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`(`}),_jsx(_components.span,{style:{color:`#B5695977`,\"--shiki-dark\":`#A6E3A1`},children:`\"`}),_jsx(_components.span,{style:{color:`#B56959`,\"--shiki-dark\":`#A6E3A1`},children:`embedding`}),_jsx(_components.span,{style:{color:`#B5695977`,\"--shiki-dark\":`#A6E3A1`},children:`\"`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`,`}),_jsx(_components.span,{style:{color:`#B07D48`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#EBA0AC`,\"--shiki-dark-font-style\":`italic`},children:` concurrency`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#94E2D5`},children:`=`}),_jsx(_components.span,{style:{color:`#2F798A`,\"--shiki-dark\":`#FAB387`},children:`1`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`)`})]}),`\n`]})})})}),`\n`,_jsx(Tip,{children:_jsxs(_components.p,{children:[`Set `,_jsx(_components.code,{children:`concurrency=1`}),` while profiling. One actor processing all batches sequentially produces a single clean trace; the default of 8 produces 8 noisier traces that you’d have to merge mentally.`]})}),`\n`,_jsx(Heading,{level:`3`,id:`step-3-—-read-the-trace`,children:`Step 3 — read the trace`}),`\n`,_jsxs(_components.p,{children:[`When backfill finishes, you’ll have one (or more) `,_jsx(_components.code,{children:`memray-\u003cpid>-\u003cuuid>.bin`}),` files under `,_jsx(_components.code,{children:`/tmp/my-udf-profile/`}),`. Render and inspect them:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`9`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes vitesse-light catppuccin-mocha`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#1e1e2e`,color:`#393a34`,\"--shiki-dark\":`#cdd6f4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`9`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#A0ADA0`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#9399B2`,\"--shiki-dark-font-style\":`italic`},children:`# Quick summary — peak heap, total allocations, what's leaked`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#59873A`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#89B4FA`,\"--shiki-dark-font-style\":`italic`},children:`uv`}),_jsx(_components.span,{style:{color:`#B56959`,\"--shiki-dark\":`#A6E3A1`},children:` run`}),_jsx(_components.span,{style:{color:`#A65E2B`,\"--shiki-dark\":`#A6E3A1`},children:` -m`}),_jsx(_components.span,{style:{color:`#B56959`,\"--shiki-dark\":`#A6E3A1`},children:` memray`}),_jsx(_components.span,{style:{color:`#B56959`,\"--shiki-dark\":`#A6E3A1`},children:` summary`}),_jsx(_components.span,{style:{color:`#B56959`,\"--shiki-dark\":`#A6E3A1`},children:` /tmp/my-udf-profile/memray-`}),_jsx(_components.span,{style:{color:`#A65E2B`,\"--shiki-dark\":`#CDD6F4`},children:`*`}),_jsx(_components.span,{style:{color:`#B56959`,\"--shiki-dark\":`#A6E3A1`},children:`.bin`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#A0ADA0`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#9399B2`,\"--shiki-dark-font-style\":`italic`},children:`# Interactive flamegraph in your browser`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#59873A`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#89B4FA`,\"--shiki-dark-font-style\":`italic`},children:`uv`}),_jsx(_components.span,{style:{color:`#B56959`,\"--shiki-dark\":`#A6E3A1`},children:` run`}),_jsx(_components.span,{style:{color:`#A65E2B`,\"--shiki-dark\":`#A6E3A1`},children:` -m`}),_jsx(_components.span,{style:{color:`#B56959`,\"--shiki-dark\":`#A6E3A1`},children:` memray`}),_jsx(_components.span,{style:{color:`#B56959`,\"--shiki-dark\":`#A6E3A1`},children:` flamegraph`}),_jsx(_components.span,{style:{color:`#B56959`,\"--shiki-dark\":`#A6E3A1`},children:` /tmp/my-udf-profile/memray-`}),_jsx(_components.span,{style:{color:`#A65E2B`,\"--shiki-dark\":`#CDD6F4`},children:`*`}),_jsx(_components.span,{style:{color:`#B56959`,\"--shiki-dark\":`#A6E3A1`},children:`.bin`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#59873A`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#89B4FA`,\"--shiki-dark-font-style\":`italic`},children:`open`}),_jsx(_components.span,{style:{color:`#B56959`,\"--shiki-dark\":`#A6E3A1`},children:` /tmp/my-udf-profile/memray-`}),_jsx(_components.span,{style:{color:`#A65E2B`,\"--shiki-dark\":`#CDD6F4`},children:`*`}),_jsx(_components.span,{style:{color:`#B56959`,\"--shiki-dark\":`#A6E3A1`},children:`.html`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#A0ADA0`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#9399B2`,\"--shiki-dark-font-style\":`italic`},children:`# Top allocators by retained bytes`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#59873A`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#89B4FA`,\"--shiki-dark-font-style\":`italic`},children:`uv`}),_jsx(_components.span,{style:{color:`#B56959`,\"--shiki-dark\":`#A6E3A1`},children:` run`}),_jsx(_components.span,{style:{color:`#A65E2B`,\"--shiki-dark\":`#A6E3A1`},children:` -m`}),_jsx(_components.span,{style:{color:`#B56959`,\"--shiki-dark\":`#A6E3A1`},children:` memray`}),_jsx(_components.span,{style:{color:`#B56959`,\"--shiki-dark\":`#A6E3A1`},children:` tree`}),_jsx(_components.span,{style:{color:`#B56959`,\"--shiki-dark\":`#A6E3A1`},children:` /tmp/my-udf-profile/memray-`}),_jsx(_components.span,{style:{color:`#A65E2B`,\"--shiki-dark\":`#CDD6F4`},children:`*`}),_jsx(_components.span,{style:{color:`#B56959`,\"--shiki-dark\":`#A6E3A1`},children:`.bin`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`what-the-numbers-mean`,children:`What the numbers mean`}),`\n`,_jsx(_components.p,{children:`memray reports two values you’ll care about most:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Peak heap`}),` (`,_jsx(_components.code,{children:`metadata.peak_memory`}),`) — the high-water mark. This is what triggers OOMs. A peak well above your `,_jsx(_components.code,{children:`setup()`}),` allocations means a batch transiently doubles memory before freeing.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Leaked allocations`}),` (`,_jsx(_components.code,{children:`get_leaked_allocation_records()`}),`) — what was still allocated when the tracker ended. `,_jsx(_components.strong,{children:`This is not necessarily a bug`}),` — your `,_jsx(_components.code,{children:`setup()`}),` model is “leaked” in this sense because it lives the actor’s lifetime. The signal is `,_jsx(_components.em,{children:`how much above expected baseline`}),` is leaked.`]}),`\n`]}),`\n`,_jsx(_components.p,{children:`A healthy stateful UDF profile, after processing many batches, looks roughly like:`}),`\n`,_jsx(CodeBlock,{numberOfLines:`3`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes vitesse-light catppuccin-mocha`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#1e1e2e`,color:`#393a34`,\"--shiki-dark\":`#cdd6f4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`3`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`peak heap ≈ setup() allocations + 1 batch of working memory`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`leaked ≈ setup() allocations (i.e. nothing extra retained from __call__)`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsxs(_components.p,{children:[`An `,_jsx(_components.strong,{children:`unhealthy`}),` profile looks like:`]}),`\n`,_jsx(CodeBlock,{numberOfLines:`3`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes vitesse-light catppuccin-mocha`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#1e1e2e`,color:`#393a34`,\"--shiki-dark\":`#cdd6f4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`3`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`peak heap ≈ setup() + N × per-call allocation ← grows with batch count`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`leaked ≈ setup() + N × per-call allocation ← per-call state never freed`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsxs(_components.p,{children:[`The flamegraph will show a thick stack frame anchored in `,_jsx(_components.code,{children:`__call__`}),` rising as you scroll through time — that’s the leak.`]}),`\n`,_jsx(Heading,{level:`2`,id:`going-deeper-rss-vs-arrow-allocations`,children:`Going deeper: RSS vs Arrow allocations`}),`\n`,_jsxs(_components.p,{children:[`memray gives you the `,_jsx(_components.em,{children:`Python-side`}),` allocation story. For real diagnosis of “where is the worker’s memory actually going?”, it pays to watch `,_jsx(_components.strong,{children:`process RSS`}),` and `,_jsx(_components.strong,{children:`Arrow’s own allocator`}),` side-by-side — together they tell you which subsystem owns the bytes, often faster than reading a flamegraph.`]}),`\n`,_jsx(_components.p,{children:`Drop this into your UDF (or anywhere on the worker) to log a snapshot:`}),`\n`,_jsx(CodeGroup,{children:_jsx(CodeBlock,{filename:`Python`,icon:`python`,numberOfLines:`16`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes vitesse-light catppuccin-mocha`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#1e1e2e`,color:`#393a34`,\"--shiki-dark\":`#cdd6f4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`16`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1E754F`,\"--shiki-dark\":`#CBA6F7`},children:`import`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:` resource`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`,`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:` pyarrow `}),_jsx(_components.span,{style:{color:`#1E754F`,\"--shiki-dark\":`#CBA6F7`},children:`as`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:` pa`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#AB5959`,\"--shiki-dark\":`#CBA6F7`},children:`def`}),_jsx(_components.span,{style:{color:`#59873A`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#89B4FA`,\"--shiki-dark-font-style\":`italic`},children:` log_memory`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`(`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#EBA0AC`,\"--shiki-dark-font-style\":`italic`},children:`seq`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`:`}),_jsx(_components.span,{style:{color:`#998418`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#CBA6F7`,\"--shiki-dark-font-style\":`italic`},children:` int`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`)`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:` ->`}),_jsx(_components.span,{style:{color:`#1E754F`,\"--shiki-dark\":`#FAB387`},children:` None`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:` rss_bytes `}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#94E2D5`},children:`=`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:` resource`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`.`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#89B4FA`},children:`getrusage`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`(`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:`resource`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`.`}),_jsx(_components.span,{style:{color:`#A65E2B`,\"--shiki-dark\":`#CDD6F4`},children:`RUSAGE_SELF`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`).`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:`ru_maxrss`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#A0ADA0`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#9399B2`,\"--shiki-dark-font-style\":`italic`},children:` # ru_maxrss is bytes on macOS, KiB on Linux:`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1E754F`,\"--shiki-dark\":`#CBA6F7`},children:` import`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:` sys`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1E754F`,\"--shiki-dark\":`#CBA6F7`},children:` if`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:` sys`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`.`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:`platform `}),_jsx(_components.span,{style:{color:`#AB5959`,\"--shiki-dark\":`#94E2D5`},children:`!=`}),_jsx(_components.span,{style:{color:`#B5695977`,\"--shiki-dark\":`#A6E3A1`},children:` \"`}),_jsx(_components.span,{style:{color:`#B56959`,\"--shiki-dark\":`#A6E3A1`},children:`darwin`}),_jsx(_components.span,{style:{color:`#B5695977`,\"--shiki-dark\":`#A6E3A1`},children:`\"`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:` rss_bytes `}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#94E2D5`},children:`*=`}),_jsx(_components.span,{style:{color:`#2F798A`,\"--shiki-dark\":`#FAB387`},children:` 1024`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:` arrow_live `}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#94E2D5`},children:`=`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:` pa`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`.`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#89B4FA`},children:`total_allocated_bytes`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`()`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#998418`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#FAB387`,\"--shiki-dark-font-style\":`italic`},children:` print`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#AB5959`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#A6E3A1`,\"--shiki-dark-font-style\":`italic`},children:` f`}),_jsx(_components.span,{style:{color:`#B56959`,\"--shiki-dark\":`#A6E3A1`},children:`\"seq=`}),_jsx(_components.span,{style:{color:`#A65E2B`,\"--shiki-dark\":`#F5C2E7`},children:`{`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:`seq`}),_jsx(_components.span,{style:{color:`#A65E2B`,\"--shiki-dark\":`#F5C2E7`},children:`}`}),_jsx(_components.span,{style:{color:`#B56959`,\"--shiki-dark\":`#A6E3A1`},children:` \"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#AB5959`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#A6E3A1`,\"--shiki-dark-font-style\":`italic`},children:` f`}),_jsx(_components.span,{style:{color:`#B56959`,\"--shiki-dark\":`#A6E3A1`},children:`\"rss_mb=`}),_jsx(_components.span,{style:{color:`#A65E2B`,\"--shiki-dark\":`#F5C2E7`},children:`{`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:`rss_bytes `}),_jsx(_components.span,{style:{color:`#AB5959`,\"--shiki-dark\":`#94E2D5`},children:`//`}),_jsx(_components.span,{style:{color:`#2F798A`,\"--shiki-dark\":`#FAB387`},children:` 1024`}),_jsx(_components.span,{style:{color:`#AB5959`,\"--shiki-dark\":`#94E2D5`},children:`**`}),_jsx(_components.span,{style:{color:`#2F798A`,\"--shiki-dark\":`#FAB387`},children:`2`}),_jsx(_components.span,{style:{color:`#A65E2B`,\"--shiki-dark\":`#F5C2E7`},children:`}`}),_jsx(_components.span,{style:{color:`#B56959`,\"--shiki-dark\":`#A6E3A1`},children:` \"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#AB5959`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#A6E3A1`,\"--shiki-dark-font-style\":`italic`},children:` f`}),_jsx(_components.span,{style:{color:`#B56959`,\"--shiki-dark\":`#A6E3A1`},children:`\"arrow_live_mb=`}),_jsx(_components.span,{style:{color:`#A65E2B`,\"--shiki-dark\":`#F5C2E7`},children:`{`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:`arrow_live `}),_jsx(_components.span,{style:{color:`#AB5959`,\"--shiki-dark\":`#94E2D5`},children:`//`}),_jsx(_components.span,{style:{color:`#2F798A`,\"--shiki-dark\":`#FAB387`},children:` 1024`}),_jsx(_components.span,{style:{color:`#AB5959`,\"--shiki-dark\":`#94E2D5`},children:`**`}),_jsx(_components.span,{style:{color:`#2F798A`,\"--shiki-dark\":`#FAB387`},children:`2`}),_jsx(_components.span,{style:{color:`#A65E2B`,\"--shiki-dark\":`#F5C2E7`},children:`}`}),_jsx(_components.span,{style:{color:`#B56959`,\"--shiki-dark\":`#A6E3A1`},children:` \"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#AB5959`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#A6E3A1`,\"--shiki-dark-font-style\":`italic`},children:` f`}),_jsx(_components.span,{style:{color:`#B56959`,\"--shiki-dark\":`#A6E3A1`},children:`\"gap_mb=`}),_jsx(_components.span,{style:{color:`#A65E2B`,\"--shiki-dark\":`#F5C2E7`},children:`{`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`(`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:`rss_bytes `}),_jsx(_components.span,{style:{color:`#AB5959`,\"--shiki-dark\":`#94E2D5`},children:`-`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:` arrow_live`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`)`}),_jsx(_components.span,{style:{color:`#AB5959`,\"--shiki-dark\":`#94E2D5`},children:` //`}),_jsx(_components.span,{style:{color:`#2F798A`,\"--shiki-dark\":`#FAB387`},children:` 1024`}),_jsx(_components.span,{style:{color:`#AB5959`,\"--shiki-dark\":`#94E2D5`},children:`**`}),_jsx(_components.span,{style:{color:`#2F798A`,\"--shiki-dark\":`#FAB387`},children:`2`}),_jsx(_components.span,{style:{color:`#A65E2B`,\"--shiki-dark\":`#F5C2E7`},children:`}`}),_jsx(_components.span,{style:{color:`#B56959`,\"--shiki-dark\":`#A6E3A1`},children:`\"`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#B07D48`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#EBA0AC`,\"--shiki-dark-font-style\":`italic`},children:` flush`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#94E2D5`},children:`=`}),_jsx(_components.span,{style:{color:`#1E754F`,\"--shiki-dark\":`#FAB387`},children:`True`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:` )`})}),`\n`]})})})}),`\n`,_jsx(_components.p,{children:`The three numbers answer different questions:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:_jsx(_components.code,{children:`rss_mb`})}),` — every byte the OS has handed this Python interpreter. Includes Python heap, Arrow, native libraries, and pages the C allocator (`,_jsx(_components.code,{children:`glibc`}),`/`,_jsx(_components.code,{children:`jemalloc`}),`) is holding even though Python freed them. This is what triggers cgroup OOM-kills.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:_jsx(_components.code,{children:`arrow_live_mb`})}),` — bytes currently held by `,_jsx(_components.em,{children:`live PyArrow buffers`}),` (`,_jsx(_components.code,{children:`RecordBatch`}),`, `,_jsx(_components.code,{children:`Array`}),`, `,_jsx(_components.code,{children:`ChunkedArray`}),`, etc.). Goes up when you create Arrow data, down when those references are dropped.`]}),`\n`,_jsxs(_components.li,{children:[_jsxs(_components.strong,{children:[_jsx(_components.code,{children:`gap_mb`}),` = rss − arrow_live`]}),` — “everything else.” This is the Python heap (your own `,_jsx(_components.code,{children:`self.cache`}),`, model weights, dicts, lists), native libraries (PyTorch, ONNX), and allocator retention.`]}),`\n`]}),`\n`,_jsx(Heading,{level:`3`,id:`diagnostic-patterns`,children:`Diagnostic patterns`}),`\n`,_jsxs(_components.p,{children:[`Log the breakdown every few batches and the `,_jsx(_components.em,{children:`shape of growth over time`}),` tells you which subsystem to fix:`]}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Pattern`}),_jsx(_components.th,{children:`Diagnosis`}),_jsx(_components.th,{children:`First thing to try`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsxs(_components.td,{children:[_jsx(_components.code,{children:`rss`}),` climbs slowly, `,_jsx(_components.code,{children:`arrow_live`}),` flat near zero, big growing `,_jsx(_components.code,{children:`gap`})]}),_jsxs(_components.td,{children:[`Allocator retention — Python freed it but `,_jsx(_components.code,{children:`glibc`}),` is keeping the pages`]}),_jsxs(_components.td,{children:[_jsx(_components.code,{children:`ctypes.CDLL(\"libc.so.6\").malloc_trim(0)`}),` periodically (Linux only); or set `,_jsx(_components.code,{children:`MALLOC_TRIM_THRESHOLD_=131072`})]})]}),_jsxs(_components.tr,{children:[_jsxs(_components.td,{children:[_jsx(_components.code,{children:`rss`}),` climbs, `,_jsx(_components.code,{children:`arrow_live`}),` climbs in lockstep`]}),_jsxs(_components.td,{children:[`Real Arrow leak — your code is holding `,_jsx(_components.code,{children:`RecordBatch`}),` / `,_jsx(_components.code,{children:`Array`}),` references`]}),_jsxs(_components.td,{children:[`Find where you’re appending batches to `,_jsx(_components.code,{children:`self`}),`, or where checkpoint / error payloads aren’t being released`]})]}),_jsxs(_components.tr,{children:[_jsxs(_components.td,{children:[_jsx(_components.code,{children:`rss`}),` spikes hugely on a few calls then settles, eventually one spike OOMs`]}),_jsx(_components.td,{children:`Peak is too big, not a leak — a single call allocates more than the worker has`}),_jsxs(_components.td,{children:[`Shrink `,_jsx(_components.code,{children:`batch_size`}),`, `,_jsx(_components.code,{children:`blob_read_buffer_size`}),`, or split the work`]})]}),_jsxs(_components.tr,{children:[_jsxs(_components.td,{children:[_jsx(_components.code,{children:`rss`}),` flat for hours then sudden cliff upward`]}),_jsx(_components.td,{children:`One pathological row — usually one huge blob (a 4K-resolution image, a 50 MB PDF)`}),_jsxs(_components.td,{children:[`Find the offending row by ID; add a size check at the top of `,_jsx(_components.code,{children:`__call__`})]})]}),_jsxs(_components.tr,{children:[_jsxs(_components.td,{children:[_jsx(_components.code,{children:`rss`}),` rises during `,_jsx(_components.code,{children:`setup()`}),`, then flat for the whole run, `,_jsx(_components.code,{children:`gap`}),` constant`]}),_jsx(_components.td,{children:`Healthy — that’s your model loaded once per actor`}),_jsx(_components.td,{children:`Nothing to do`})]})]})]}),`\n`,_jsx(Tip,{children:_jsxs(_components.p,{children:[`The reference UDFs in Geneva’s own integration test (`,_jsx(_components.code,{children:`src/stress_tests/_memray_probe.py`}),`) print exactly this breakdown every 32 calls. The workflow’s stdout logs are a working example of the “clean” and “leaky” patterns — the leaky one shows the `,_jsx(_components.strong,{children:`lockstep with Python heap`}),` signature (the second row above, but with `,_jsx(_components.code,{children:`gap`}),` climbing instead of `,_jsx(_components.code,{children:`arrow_live`}),` — because the leak is `,_jsx(_components.code,{children:`bytearray`}),`, not Arrow).`]})}),`\n`,_jsx(Heading,{level:`2`,id:`common-leak-patterns`,children:`Common leak patterns`}),`\n`,_jsx(Heading,{level:`3`,id:`1-the-growing-cache`,children:`1. The growing cache`}),`\n`,_jsx(CodeGroup,{children:_jsx(CodeBlock,{filename:`Python`,icon:`python`,numberOfLines:`8`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes vitesse-light catppuccin-mocha`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#1e1e2e`,color:`#393a34`,\"--shiki-dark\":`#cdd6f4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`8`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#AB5959`,\"--shiki-dark\":`#CBA6F7`},children:`class`}),_jsx(_components.span,{style:{color:`#2E8F82`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#F9E2AF`,\"--shiki-dark-font-style\":`italic`},children:` BadEmbedding`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#AB5959`,\"--shiki-dark\":`#CBA6F7`},children:` def`}),_jsx(_components.span,{style:{color:`#998418`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#89DCEB`,\"--shiki-dark-font-style\":`italic`},children:` __init__`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`(`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#F38BA8`,\"--shiki-dark-font-style\":`italic`},children:`self`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`):`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#A65E2B`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#F38BA8`,\"--shiki-dark-font-style\":`italic`},children:` self`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`.`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:`cache`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`:`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#EBA0AC`,\"--shiki-dark-font-style\":`italic`},children:` dict`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`[`}),_jsx(_components.span,{style:{color:`#998418`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#CBA6F7`,\"--shiki-dark-font-style\":`italic`},children:`str`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`,`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#EBA0AC`,\"--shiki-dark-font-style\":`italic`},children:` list`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`[`}),_jsx(_components.span,{style:{color:`#998418`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#CBA6F7`,\"--shiki-dark-font-style\":`italic`},children:`float`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`]]`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#94E2D5`},children:` =`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:` {}`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#AB5959`,\"--shiki-dark\":`#CBA6F7`},children:` def`}),_jsx(_components.span,{style:{color:`#998418`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#89DCEB`,\"--shiki-dark-font-style\":`italic`},children:` __call__`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`(`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#F38BA8`,\"--shiki-dark-font-style\":`italic`},children:`self`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`,`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#EBA0AC`,\"--shiki-dark-font-style\":`italic`},children:` text`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`:`}),_jsx(_components.span,{style:{color:`#998418`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#CBA6F7`,\"--shiki-dark-font-style\":`italic`},children:` str`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`)`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:` ->`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#EBA0AC`,\"--shiki-dark-font-style\":`italic`},children:` list`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`[`}),_jsx(_components.span,{style:{color:`#998418`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#CBA6F7`,\"--shiki-dark-font-style\":`italic`},children:`float`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`]:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1E754F`,\"--shiki-dark\":`#CBA6F7`},children:` if`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:` text `}),_jsx(_components.span,{style:{color:`#AB5959`,\"--shiki-dark\":`#CBA6F7`},children:`not`}),_jsx(_components.span,{style:{color:`#AB5959`,\"--shiki-dark\":`#CBA6F7`},children:` in`}),_jsx(_components.span,{style:{color:`#A65E2B`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#F38BA8`,\"--shiki-dark-font-style\":`italic`},children:` self`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`.`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:`cache`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#A65E2B`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#F38BA8`,\"--shiki-dark-font-style\":`italic`},children:` self`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`.`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#EBA0AC`,\"--shiki-dark-font-style\":`italic`},children:`cache`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`[`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#EBA0AC`,\"--shiki-dark-font-style\":`italic`},children:`text`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`]`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#94E2D5`},children:` =`}),_jsx(_components.span,{style:{color:`#A65E2B`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#F38BA8`,\"--shiki-dark-font-style\":`italic`},children:` self`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`.`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:`model`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`.`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#89B4FA`},children:`embed`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`(`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:`text`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1E754F`,\"--shiki-dark\":`#CBA6F7`},children:` return`}),_jsx(_components.span,{style:{color:`#A65E2B`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#F38BA8`,\"--shiki-dark-font-style\":`italic`},children:` self`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`.`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#EBA0AC`,\"--shiki-dark-font-style\":`italic`},children:`cache`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`[`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#EBA0AC`,\"--shiki-dark-font-style\":`italic`},children:`text`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`]`})]}),`\n`]})})})}),`\n`,_jsxs(_components.p,{children:[`Looks harmless. Fine on a unit test with 10 inputs. `,_jsx(_components.strong,{children:`Catastrophic on a backfill of 10M rows`}),`, where most inputs are unique and the cache grows to fill the worker.`]}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Fix:`}),` Use a bounded cache (`,_jsx(_components.code,{children:`functools.lru_cache`}),` with `,_jsx(_components.code,{children:`maxsize`}),`, or a manual size cap), or skip caching when you don’t know the cardinality.`]}),`\n`,_jsx(CodeGroup,{children:_jsx(CodeBlock,{filename:`Python`,icon:`python`,numberOfLines:`14`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes vitesse-light catppuccin-mocha`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#1e1e2e`,color:`#393a34`,\"--shiki-dark\":`#cdd6f4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`14`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1E754F`,\"--shiki-dark\":`#CBA6F7`},children:`from`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:` functools `}),_jsx(_components.span,{style:{color:`#1E754F`,\"--shiki-dark\":`#CBA6F7`},children:`import`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:` lru_cache`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#AB5959`,\"--shiki-dark\":`#CBA6F7`},children:`class`}),_jsx(_components.span,{style:{color:`#2E8F82`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#F9E2AF`,\"--shiki-dark-font-style\":`italic`},children:` GoodEmbedding`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#AB5959`,\"--shiki-dark\":`#CBA6F7`},children:` def`}),_jsx(_components.span,{style:{color:`#998418`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#89DCEB`,\"--shiki-dark-font-style\":`italic`},children:` __init__`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`(`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#F38BA8`,\"--shiki-dark-font-style\":`italic`},children:`self`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`):`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#A65E2B`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#F38BA8`,\"--shiki-dark-font-style\":`italic`},children:` self`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`.`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:`_embed `}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#94E2D5`},children:`=`}),_jsx(_components.span,{style:{color:`#1E754F`,\"--shiki-dark\":`#FAB387`},children:` None`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#AB5959`,\"--shiki-dark\":`#CBA6F7`},children:` def`}),_jsx(_components.span,{style:{color:`#59873A`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#89B4FA`,\"--shiki-dark-font-style\":`italic`},children:` setup`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`(`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#F38BA8`,\"--shiki-dark-font-style\":`italic`},children:`self`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`):`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:` model `}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#94E2D5`},children:`=`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#89B4FA`},children:` load_model`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`()`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#A65E2B`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#F38BA8`,\"--shiki-dark-font-style\":`italic`},children:` self`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`.`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:`_embed `}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#94E2D5`},children:`=`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#89B4FA`},children:` lru_cache`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`(`}),_jsx(_components.span,{style:{color:`#B07D48`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#EBA0AC`,\"--shiki-dark-font-style\":`italic`},children:`maxsize`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#94E2D5`},children:`=`}),_jsx(_components.span,{style:{color:`#2F798A`,\"--shiki-dark\":`#FAB387`},children:`1024`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`)(`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:`model`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`.`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:`embed`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#AB5959`,\"--shiki-dark\":`#CBA6F7`},children:` def`}),_jsx(_components.span,{style:{color:`#998418`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#89DCEB`,\"--shiki-dark-font-style\":`italic`},children:` __call__`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`(`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#F38BA8`,\"--shiki-dark-font-style\":`italic`},children:`self`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`,`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#EBA0AC`,\"--shiki-dark-font-style\":`italic`},children:` text`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`:`}),_jsx(_components.span,{style:{color:`#998418`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#CBA6F7`,\"--shiki-dark-font-style\":`italic`},children:` str`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`)`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:` ->`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#EBA0AC`,\"--shiki-dark-font-style\":`italic`},children:` list`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`[`}),_jsx(_components.span,{style:{color:`#998418`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#CBA6F7`,\"--shiki-dark-font-style\":`italic`},children:`float`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`]:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1E754F`,\"--shiki-dark\":`#CBA6F7`},children:` if`}),_jsx(_components.span,{style:{color:`#A65E2B`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#F38BA8`,\"--shiki-dark-font-style\":`italic`},children:` self`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`.`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:`_embed `}),_jsx(_components.span,{style:{color:`#AB5959`,\"--shiki-dark\":`#CBA6F7`},children:`is`}),_jsx(_components.span,{style:{color:`#1E754F`,\"--shiki-dark\":`#FAB387`},children:` None`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#A65E2B`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#F38BA8`,\"--shiki-dark-font-style\":`italic`},children:` self`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`.`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#89B4FA`},children:`setup`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`()`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1E754F`,\"--shiki-dark\":`#CBA6F7`},children:` return`}),_jsx(_components.span,{style:{color:`#A65E2B`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#F38BA8`,\"--shiki-dark-font-style\":`italic`},children:` self`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`.`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#89B4FA`},children:`_embed`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`(`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:`text`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`)`})]}),`\n`]})})})}),`\n`,_jsx(Heading,{level:`3`,id:`2-accumulating-per-call-buffers`,children:`2. Accumulating per-call buffers`}),`\n`,_jsx(CodeGroup,{children:_jsx(CodeBlock,{filename:`Python`,icon:`python`,numberOfLines:`7`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes vitesse-light catppuccin-mocha`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#1e1e2e`,color:`#393a34`,\"--shiki-dark\":`#cdd6f4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`7`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#AB5959`,\"--shiki-dark\":`#CBA6F7`},children:`class`}),_jsx(_components.span,{style:{color:`#2E8F82`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#F9E2AF`,\"--shiki-dark-font-style\":`italic`},children:` BadAggregator`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#AB5959`,\"--shiki-dark\":`#CBA6F7`},children:` def`}),_jsx(_components.span,{style:{color:`#998418`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#89DCEB`,\"--shiki-dark-font-style\":`italic`},children:` __init__`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`(`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#F38BA8`,\"--shiki-dark-font-style\":`italic`},children:`self`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`):`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#A65E2B`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#F38BA8`,\"--shiki-dark-font-style\":`italic`},children:` self`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`.`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:`history `}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#94E2D5`},children:`=`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:` []`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#AB5959`,\"--shiki-dark\":`#CBA6F7`},children:` def`}),_jsx(_components.span,{style:{color:`#998418`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#89DCEB`,\"--shiki-dark-font-style\":`italic`},children:` __call__`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`(`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#F38BA8`,\"--shiki-dark-font-style\":`italic`},children:`self`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`,`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#EBA0AC`,\"--shiki-dark-font-style\":`italic`},children:` batch`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`:`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#EBA0AC`},children:` pa`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`.`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#EBA0AC`},children:`RecordBatch`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`)`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:` ->`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:` pa`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`.`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:`Array`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#A65E2B`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#F38BA8`,\"--shiki-dark-font-style\":`italic`},children:` self`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`.`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:`history`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`.`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#89B4FA`},children:`append`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`(`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:`batch`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`)`}),_jsx(_components.span,{style:{color:`#A0ADA0`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#9399B2`,\"--shiki-dark-font-style\":`italic`},children:` # holds every batch ever processed`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#A65E2B`,\"--shiki-dark\":`#CDD6F4`},children:` ...`})}),`\n`]})})})}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Fix:`}),` Don’t hold references to inputs past the return of `,_jsx(_components.code,{children:`__call__`}),`. If you need rolling state, summarize into a small aggregate (counts, sums) instead of holding the raw batches.`]}),`\n`,_jsx(Heading,{level:`3`,id:`3-closures-capturing-batch-arrays`,children:`3. Closures capturing batch arrays`}),`\n`,_jsx(CodeGroup,{children:_jsx(CodeBlock,{filename:`Python`,icon:`python`,numberOfLines:`8`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes vitesse-light catppuccin-mocha`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#1e1e2e`,color:`#393a34`,\"--shiki-dark\":`#cdd6f4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`8`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#AB5959`,\"--shiki-dark\":`#CBA6F7`},children:`class`}),_jsx(_components.span,{style:{color:`#2E8F82`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#F9E2AF`,\"--shiki-dark-font-style\":`italic`},children:` BadDeferred`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#AB5959`,\"--shiki-dark\":`#CBA6F7`},children:` def`}),_jsx(_components.span,{style:{color:`#998418`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#89DCEB`,\"--shiki-dark-font-style\":`italic`},children:` __init__`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`(`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#F38BA8`,\"--shiki-dark-font-style\":`italic`},children:`self`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`):`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#A65E2B`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#F38BA8`,\"--shiki-dark-font-style\":`italic`},children:` self`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`.`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:`work_queue `}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#94E2D5`},children:`=`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:` []`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#AB5959`,\"--shiki-dark\":`#CBA6F7`},children:` def`}),_jsx(_components.span,{style:{color:`#998418`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#89DCEB`,\"--shiki-dark-font-style\":`italic`},children:` __call__`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`(`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#F38BA8`,\"--shiki-dark-font-style\":`italic`},children:`self`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`,`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#EBA0AC`,\"--shiki-dark-font-style\":`italic`},children:` x`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`:`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#EBA0AC`},children:` pa`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`.`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#EBA0AC`},children:`Array`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`)`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:` ->`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:` pa`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`.`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:`Array`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`:`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#A0ADA0`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#9399B2`,\"--shiki-dark-font-style\":`italic`},children:\" # Lambda captures `x` by reference — the whole Array stays alive\"})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#A65E2B`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#F38BA8`,\"--shiki-dark-font-style\":`italic`},children:` self`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`.`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:`work_queue`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`.`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#89B4FA`},children:`append`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`(`}),_jsx(_components.span,{style:{color:`#AB5959`,\"--shiki-dark\":`#CBA6F7`},children:`lambda`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`:`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#89B4FA`},children:` expensive`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`(`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:`x`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`))`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#A65E2B`,\"--shiki-dark\":`#CDD6F4`},children:` ...`})}),`\n`]})})})}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Fix:`}),` Extract only the small values you actually need into the closure, or execute the work eagerly.`]}),`\n`,_jsx(Heading,{level:`3`,id:`4-ml-model-state-that-grows`,children:`4. ML model state that grows`}),`\n`,_jsx(_components.p,{children:`Some ML libraries retain per-call state internally (KV caches, gradient buffers, autograd graphs). If you’re using PyTorch:`}),`\n`,_jsx(CodeGroup,{children:_jsx(CodeBlock,{filename:`Python`,icon:`python`,numberOfLines:`3`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes vitesse-light catppuccin-mocha`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#1e1e2e`,color:`#393a34`,\"--shiki-dark\":`#cdd6f4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`3`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#AB5959`,\"--shiki-dark\":`#CBA6F7`},children:`def`}),_jsx(_components.span,{style:{color:`#998418`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#89DCEB`,\"--shiki-dark-font-style\":`italic`},children:` __call__`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`(`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#F38BA8`,\"--shiki-dark-font-style\":`italic`},children:`self`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`,`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#EBA0AC`,\"--shiki-dark-font-style\":`italic`},children:` text`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`:`}),_jsx(_components.span,{style:{color:`#998418`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#CBA6F7`,\"--shiki-dark-font-style\":`italic`},children:` str`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`)`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:` ->`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#EBA0AC`,\"--shiki-dark-font-style\":`italic`},children:` list`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`[`}),_jsx(_components.span,{style:{color:`#998418`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#CBA6F7`,\"--shiki-dark-font-style\":`italic`},children:`float`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`]:`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1E754F`,\"--shiki-dark\":`#CBA6F7`},children:` with`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:` torch`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`.`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#89B4FA`},children:`inference_mode`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`():`}),_jsx(_components.span,{style:{color:`#A0ADA0`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#9399B2`,\"--shiki-dark-font-style\":`italic`},children:` # \u003c-- prevents autograd graph retention`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1E754F`,\"--shiki-dark\":`#CBA6F7`},children:` return`}),_jsx(_components.span,{style:{color:`#A65E2B`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#F38BA8`,\"--shiki-dark-font-style\":`italic`},children:` self`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`.`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:`model`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`.`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#89B4FA`},children:`encode`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`(`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:`text`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`)`})]}),`\n`]})})})}),`\n`,_jsxs(_components.p,{children:[`For Hugging Face pipelines, ensure you’re in `,_jsx(_components.code,{children:`eval()`}),` mode and not accumulating gradients. For long-running stateful UDFs on GPUs, also see `,_jsx(_components.code,{children:`torch.cuda.empty_cache()`}),` between large batches.`]}),`\n`,_jsx(Heading,{level:`2`,id:`a-confidence-check`,children:`A confidence check`}),`\n`,_jsx(_components.p,{children:`A useful “does my profiling actually work?” sanity check: temporarily introduce a deliberate leak and confirm memray catches it.`}),`\n`,_jsx(CodeGroup,{children:_jsx(CodeBlock,{filename:`Python`,icon:`python`,numberOfLines:`4`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes vitesse-light catppuccin-mocha`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#1e1e2e`,color:`#393a34`,\"--shiki-dark\":`#cdd6f4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`4`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#AB5959`,\"--shiki-dark\":`#CBA6F7`},children:`def`}),_jsx(_components.span,{style:{color:`#998418`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#89DCEB`,\"--shiki-dark-font-style\":`italic`},children:` __call__`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`(`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#F38BA8`,\"--shiki-dark-font-style\":`italic`},children:`self`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`,`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#EBA0AC`,\"--shiki-dark-font-style\":`italic`},children:` x`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`):`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:` scratch `}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#94E2D5`},children:`=`}),_jsx(_components.span,{style:{color:`#998418`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#CBA6F7`,\"--shiki-dark-font-style\":`italic`},children:` bytearray`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`(`}),_jsx(_components.span,{style:{color:`#2F798A`,\"--shiki-dark\":`#FAB387`},children:`8`}),_jsx(_components.span,{style:{color:`#AB5959`,\"--shiki-dark\":`#94E2D5`},children:` *`}),_jsx(_components.span,{style:{color:`#2F798A`,\"--shiki-dark\":`#FAB387`},children:` 1024`}),_jsx(_components.span,{style:{color:`#AB5959`,\"--shiki-dark\":`#94E2D5`},children:` *`}),_jsx(_components.span,{style:{color:`#2F798A`,\"--shiki-dark\":`#FAB387`},children:` 1024`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`)`}),_jsx(_components.span,{style:{color:`#A0ADA0`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#9399B2`,\"--shiki-dark-font-style\":`italic`},children:` # 8 MiB`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#A65E2B`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#F38BA8`,\"--shiki-dark-font-style\":`italic`},children:` self`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`.`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:`_scratches`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`.`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#89B4FA`},children:`append`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`(`}),_jsx(_components.span,{style:{color:`#393A34`,\"--shiki-dark\":`#CDD6F4`},children:`scratch`}),_jsx(_components.span,{style:{color:`#999999`,\"--shiki-dark\":`#9399B2`},children:`)`}),_jsx(_components.span,{style:{color:`#A0ADA0`,\"--shiki-light-font-style\":`inherit`,\"--shiki-dark\":`#9399B2`,\"--shiki-dark-font-style\":`italic`},children:` # \u003c-- deliberate leak`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1E754F`,\"--shiki-dark\":`#CBA6F7`},children:` return`}),_jsx(_components.span,{style:{color:`#A65E2B`,\"--shiki-dark\":`#CDD6F4`},children:` ...`})]}),`\n`]})})})}),`\n`,_jsxs(_components.p,{children:[`If `,_jsx(_components.code,{children:`memray summary`}),` doesn’t show leaked bytes growing roughly with batch count after this change, your tracker isn’t actually attached (most often: the env var isn’t reaching workers — re-check `,_jsx(_components.code,{children:`extra_env`}),`).`]}),`\n`,_jsxs(_components.p,{children:[`Geneva’s own test suite ships a reference implementation of this pattern in `,_jsx(_components.code,{children:`src/stress_tests/_memray_probe.py`}),` and `,_jsx(_components.code,{children:`src/stress_tests/test_memray_stateful_udf.py`}),`, plus a GitHub Actions workflow (`,_jsx(_components.code,{children:`memray-stateful-udf-profile.yml`}),`) that uploads the per-actor `,_jsx(_components.code,{children:`.bin`}),` and rendered flamegraph as a CI artifact. Feel free to copy that scaffolding for your own project’s UDFs.`]}),`\n`,_jsx(Heading,{level:`2`,id:`related`,children:`Related`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.a,{href:`/oss/v0-41-0/geneva/udfs/udfs`,children:`UDFs`}),` — defining stateful UDFs`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.a,{href:`/oss/v0-41-0/geneva/jobs/troubleshooting`,children:`Job troubleshooting`}),` — diagnosing OOMs and other worker errors`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.a,{href:`/oss/v0-41-0/geneva/udfs/advanced-configuration`,children:`Advanced configuration`}),` — admission control and resource limits`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.a,{href:`https://bloomberg.github.io/memray/`,children:`memray documentation`}),` — flamegraph, summary, and tree report formats`]}),`\n`]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"codeStyling":{"theme":{"light":"vitesse-light","dark":"catppuccin-mocha"}},"config":{},"pageMetadata":{"title":"Profiling Stateful UDF Memory","sidebarTitle":"Profiling Memory","description":"Find memory leaks and runaway peak usage in stateful UDFs with memray, before they cause worker OOMs in production.","icon":"chart-line","href":"/oss/v0-41-0/geneva/udfs/profiling-memory"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Why stateful UDFs leak","slug":"why-stateful-udfs-leak","depth":2,"children":[]},{"title":"When to profile","slug":"when-to-profile","depth":2,"children":[]},{"title":"Profiling a UDF with memray","slug":"profiling-a-udf-with-memray","depth":2,"children":[{"title":"Step 1 — add an opt-in tracker to your UDF","slug":"step-1-—-add-an-opt-in-tracker-to-your-udf","depth":3,"children":[]},{"title":"Step 2 — propagate the env var to Ray workers","slug":"step-2-—-propagate-the-env-var-to-ray-workers","depth":3,"children":[]},{"title":"Step 3 — read the trace","slug":"step-3-—-read-the-trace","depth":3,"children":[]}]},{"title":"What the numbers mean","slug":"what-the-numbers-mean","depth":2,"children":[]},{"title":"Going deeper: RSS vs Arrow allocations","slug":"going-deeper-rss-vs-arrow-allocations","depth":2,"children":[{"title":"Diagnostic patterns","slug":"diagnostic-patterns","depth":3,"children":[]}]},{"title":"Common leak patterns","slug":"common-leak-patterns","depth":2,"children":[{"title":"1. The growing cache","slug":"1-the-growing-cache","depth":3,"children":[]},{"title":"2. Accumulating per-call buffers","slug":"2-accumulating-per-call-buffers","depth":3,"children":[]},{"title":"3. Closures capturing batch arrays","slug":"3-closures-capturing-batch-arrays","depth":3,"children":[]},{"title":"4. ML model state that grows","slug":"4-ml-model-state-that-grows","depth":3,"children":[]}]},{"title":"A confidence check","slug":"a-confidence-check","depth":2,"children":[]},{"title":"Related","slug":"related","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":["/_mintlify/custom/lancedb-bcbb4faf/71b64c20a8f631b3/static/scripts/cookie-consent.js"],"subdomain":"lancedb-bcbb4faf","siteName":"LanceDB","title":"Profiling Stateful UDF Memory - LanceDB","navMaps":{"firstHrefInVersion":{"1.12.0":{"href":"/enterprise/v1-12-0","matchLevel":4},"0.41.0":{"href":"/oss/v0-41-0/geneva/udfs/profiling-memory","matchLevel":0}},"firstHrefInLanguage":{}},"lastModified":"2026-11-12T01:15:01.097Z","originalFileLocation":"oss/v0-41-0/geneva/udfs/profiling-memory.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Find memory leaks and runaway peak usage in stateful UDFs with memray, before they cause worker OOMs in production.\">\u003cmeta data-mint-head name=\"application-name\" content=\"LanceDB\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/lancedb-bcbb4faf/AJCI1CXWoYDPZbb4/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/lancedb-bcbb4faf/AJCI1CXWoYDPZbb4/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/lancedb-bcbb4faf/AJCI1CXWoYDPZbb4/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/lancedb-bcbb4faf/AJCI1CXWoYDPZbb4/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/lancedb-bcbb4faf/AJCI1CXWoYDPZbb4/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/lancedb-bcbb4faf/AJCI1CXWoYDPZbb4/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/lancedb-bcbb4faf/AJCI1CXWoYDPZbb4/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/lancedb-bcbb4faf/AJCI1CXWoYDPZbb4/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/lancedb-bcbb4faf/AJCI1CXWoYDPZbb4/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Profiling Stateful UDF Memory - LanceDB\">\u003cmeta data-mint-head property=\"og:description\" content=\"Find memory leaks and runaway peak usage in stateful UDFs with memray, before they cause worker OOMs in production.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"LanceDB\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.lancedb.com/oss/v0-41-0/geneva/udfs/profiling-memory\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://lancedb-bcbb4faf.mintlify.site/_mintlify/api/og/v2?division=Transforms\u0026amp;title=Profiling+Stateful+UDF+Memory\u0026amp;description=Find+memory+leaks+and+runaway+peak+usage+in+stateful+UDFs+with+memray%2C+before+they+cause+worker+OOMs+in+production.\u0026amp;theme=9d8045ca9469df4ceece463f\u0026amp;signature=20a1a722c4e5ae7d6fb71d70fb82b76d810030a4de3e9db1eef2c28926f4a930\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Profiling Stateful UDF Memory - LanceDB\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Find memory leaks and runaway peak usage in stateful UDFs with memray, before they cause worker OOMs in production.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://lancedb-bcbb4faf.mintlify.site/_mintlify/api/og/v2?division=Transforms\u0026amp;title=Profiling+Stateful+UDF+Memory\u0026amp;description=Find+memory+leaks+and+runaway+peak+usage+in+stateful+UDFs+with+memray%2C+before+they+cause+worker+OOMs+in+production.\u0026amp;theme=9d8045ca9469df4ceece463f\u0026amp;signature=20a1a722c4e5ae7d6fb71d70fb82b76d810030a4de3e9db1eef2c28926f4a930\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/lancedb-bcbb4faf/AJCI1CXWoYDPZbb4/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"LanceDB\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#FF6B35\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.lancedb.com/oss/v0-41-0/geneva/udfs/profiling-memory\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/oss/v0-41-0/geneva/udfs/profiling-memory.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.lancedb.com/#organization\",\"name\":\"LanceDB\",\"url\":\"https://docs.lancedb.com\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/lancedb-bcbb4faf/6L0IRVkfdlgMU1Pw/static/assets/logo/dark-lancedb-logo.svg?fit=max\u0026auto=format\u0026n=6L0IRVkfdlgMU1Pw\u0026q=85\u0026s=d0592e59a29df2477080a857e13e341f\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.lancedb.com#website\",\"name\":\"LanceDB\",\"url\":\"https://docs.lancedb.com\",\"publisher\":{\"@id\":\"https://docs.lancedb.com/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.lancedb.com/oss/v0-41-0/geneva/udfs/profiling-memory#webpage\",\"url\":\"https://docs.lancedb.com/oss/v0-41-0/geneva/udfs/profiling-memory\",\"name\":\"Profiling Stateful UDF Memory\",\"description\":\"Find memory leaks and runaway peak usage in stateful UDFs with memray, before they cause worker OOMs in production.\",\"dateModified\":\"2026-11-12T01:15:01.097Z\",\"isPartOf\":{\"@id\":\"https://docs.lancedb.com#website\"},\"breadcrumb\":{\"@id\":\"https://docs.lancedb.com/oss/v0-41-0/geneva/udfs/profiling-memory#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.lancedb.com/oss/v0-41-0/geneva/udfs/profiling-memory#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Feature Engineering\",\"item\":\"https://docs.lancedb.com/oss/v0-41-0/feature-engineering\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Geneva\",\"item\":\"https://docs.lancedb.com/oss/v0-41-0/geneva\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Transforms\",\"item\":\"https://docs.lancedb.com/oss/v0-41-0/geneva/udfs\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Profiling Stateful UDF Memory\",\"item\":\"https://docs.lancedb.com/oss/v0-41-0/geneva/udfs/profiling-memory\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.lancedb.com/oss/v0-41-0/geneva/udfs/profiling-memory#article\",\"headline\":\"Profiling Stateful UDF Memory\",\"name\":\"Profiling Stateful UDF Memory\",\"description\":\"Find memory leaks and runaway peak usage in stateful UDFs with memray, before they cause worker OOMs in production.\",\"url\":\"https://docs.lancedb.com/oss/v0-41-0/geneva/udfs/profiling-memory\",\"mainEntityOfPage\":{\"@id\":\"https://docs.lancedb.com/oss/v0-41-0/geneva/udfs/profiling-memory#webpage\"},\"dateModified\":\"2026-11-12T01:15:01.097Z\",\"publisher\":{\"@id\":\"https://docs.lancedb.com/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.lancedb.com#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"LanceDB\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"LanceDB\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/oss/v0-41-0/geneva/udfs/profiling-memory.md","siteName":"LanceDB","nav":{"global":null,"products":[{"product":"Enterprise","icon":"server","description":"Multimodal lakehouse","pages":[{"title":"Enterprise","href":"/enterprise/v1-12-0"}]},{"product":"Embedded","icon":"database","description":"Open-source library","versions":[{"version":"0.41.0","default":true,"tag":"Latest","tabs":[{"tab":"Documentation","groups":[{"group":"Introduction","pages":[{"title":"LanceDB","sidebarTitle":"LanceDB","icon":"https://mintlify.s3.us-west-1.amazonaws.com/lancedb-bcbb4faf/oss/v0-41-0/static/assets/logo/lancedb-icon-gray.svg","href":"/oss/v0-41-0"},{"title":"LanceDB Embedded","sidebarTitle":"LanceDB Embedded","icon":"cube","href":"/oss/v0-41-0/basics/lancedb-embedded"},{"title":"LanceDB Enterprise","sidebarTitle":"LanceDB Enterprise","icon":"server","href":"/oss/v0-41-0/enterprise/index"},{"title":"Embedded vs Enterprise","sidebarTitle":"Embedded vs Enterprise","icon":"scale-balanced","href":"/oss/v0-41-0/basics/embedded-vs-enterprise"},{"title":"About this version","icon":"circle-info","href":"/oss/v0-41-0/about-this-version"}]},{"group":"Getting Started","pages":[{"title":"Quickstart","sidebarTitle":"Quickstart","icon":"rocket","href":"/oss/v0-41-0/quickstart"},{"title":"SDKs","sidebarTitle":"SDKs","icon":"code-compare","href":"/oss/v0-41-0/basics/sdk"},{"title":"SQL","sidebarTitle":"SQL","icon":"table-list","href":"/oss/v0-41-0/basics/sql"},{"title":"Console","sidebarTitle":"Console","icon":"window","href":"/oss/v0-41-0/enterprise/console"},{"title":"Agentic skills","sidebarTitle":"Agentic Skills","icon":"robot","href":"/oss/v0-41-0/basics/agentic-skills"},{"title":"Support","sidebarTitle":"Support","icon":"circle-question","href":"/oss/v0-41-0/deployment/support"}]},{"group":"Concepts","pages":[{"title":"Lance format","sidebarTitle":"Lance Format","icon":"https://mintlify.s3.us-west-1.amazonaws.com/lancedb-bcbb4faf/oss/v0-41-0/static/assets/logo/lance-logo-gray.png","href":"/oss/v0-41-0/basics/lance"},{"title":"LanceDB Lakehouse","sidebarTitle":"LanceDB Lakehouse","icon":"sitemap","href":"/oss/v0-41-0/basics/catalog"},{"title":"Job Framework","sidebarTitle":"Job Framework","icon":"hourglass-half","href":"/oss/v0-41-0/basics/jobs"},{"title":"Real Time engine (RTE)","sidebarTitle":"Real Time Engine (RTE)","icon":"bolt","href":"/oss/v0-41-0/tables/realtime-engine"},{"title":"Consistency","sidebarTitle":"Consistency","icon":"water","href":"/oss/v0-41-0/tables/consistency"},{"title":"Guarantees","sidebarTitle":"Guarantees","icon":"shield-check","href":"/oss/v0-41-0/basics/guarantees"},{"title":"Limits","sidebarTitle":"Limits","icon":"ruler","href":"/oss/v0-41-0/basics/limits"},{"title":"Naming rules","sidebarTitle":"Naming Rules","icon":"signature","href":"/oss/v0-41-0/basics/naming"}]},{"group":"Data Ingestion","pages":[{"title":"Ingesting data","sidebarTitle":"Overview","icon":"inbox","href":"/oss/v0-41-0/ingestion/index"},{"title":"Creating a table","sidebarTitle":"Create Table","icon":"table","href":"/oss/v0-41-0/ingestion/create-table"},{"title":"Insert data","sidebarTitle":"Insert","icon":"plus","href":"/oss/v0-41-0/ingestion/insert"},{"title":"Update rows","sidebarTitle":"Update","icon":"pen","href":"/oss/v0-41-0/ingestion/update"},{"title":"Delete rows","sidebarTitle":"Delete","icon":"trash","href":"/oss/v0-41-0/ingestion/delete"},{"title":"RTE Write (Upsert)","sidebarTitle":"RTE Write (Upsert)","icon":"bolt","href":"/oss/v0-41-0/ingestion/realtime-write"},{"title":"Define Storage Integration","sidebarTitle":"Define Storage Integration","icon":"cloud","href":"/oss/v0-41-0/ingestion/define-storage-integration"},{"title":"Attach Database","sidebarTitle":"Attach Database","icon":"plug","href":"/oss/v0-41-0/ingestion/migrate-from-embedded"},{"title":"Import Datasets","sidebarTitle":"Import Datasets","icon":"file-import","href":"/oss/v0-41-0/ingestion/import"},{"title":"Distributed Write","sidebarTitle":"Distributed Write","icon":"upload","href":"/oss/v0-41-0/enterprise/distributed-write"},{"title":"Distributed RTE Write","sidebarTitle":"Distributed RTE Write","icon":"bolt","href":"/oss/v0-41-0/enterprise/distributed-real-time-write"}]},{"group":"Search","pages":[{"title":"Search","sidebarTitle":"Overview","icon":"list","href":"/oss/v0-41-0/search/index"},{"title":"Vector Search","sidebarTitle":"Vector Search","icon":"arrow-up-right-dots","href":"/oss/v0-41-0/search/vector-search"},{"title":"Full-Text Search (FTS)","sidebarTitle":"Full-Text Search (FTS)","icon":"book","href":"/oss/v0-41-0/search/full-text-search"},{"title":"Hybrid Search","sidebarTitle":"Hybrid Search","icon":"search","href":"/oss/v0-41-0/search/hybrid-search"},{"title":"Metadata Filtering in LanceDB","sidebarTitle":"Filtering","icon":"filter","href":"/oss/v0-41-0/search/filtering"},{"title":"Reranking Search Results","sidebarTitle":"Reranking","icon":"sort-amount-down","href":"/oss/v0-41-0/reranking/index"},{"title":"RTE reads","sidebarTitle":"RTE Read","icon":"magnifying-glass","href":"/oss/v0-41-0/search/realtime-read"},{"title":"Distributed RTE Read","sidebarTitle":"Distributed RTE Read","icon":"network-wired","href":"/oss/v0-41-0/enterprise/distributed-real-time-read"},{"title":"Distributed Search","sidebarTitle":"Distributed Search","icon":"network-wired","href":"/oss/v0-41-0/enterprise/distributed-search"},{"title":"Data Page Cache","sidebarTitle":"Data Page Cache","icon":"database","href":"/oss/v0-41-0/enterprise/data-page-cache"},{"title":"Tiered Index Cache","sidebarTitle":"Tiered Index Cache","icon":"layer-group","href":"/oss/v0-41-0/enterprise/tiered-index-cache"},{"title":"Cache Prewarm","sidebarTitle":"Cache Prewarm","icon":"fire","href":"/oss/v0-41-0/enterprise/cache-prewarm"}]},{"group":"Data Curation","pages":[{"title":"Data curation","sidebarTitle":"Overview","icon":"filter","href":"/oss/v0-41-0/curation/index"},{"title":"Inspect Datasets","sidebarTitle":"Inspect Datasets","icon":"database","href":"/oss/v0-41-0/curation/inspect-datasets"},{"title":"Create a Function","tag":"Early access","sidebarTitle":"Create Function","icon":"code","href":"/oss/v0-41-0/curation/create-function"},{"title":"Chunk records into multiple rows","sidebarTitle":"Chunking","icon":"diagram-subtask","href":"/oss/v0-41-0/curation/chunking"},{"title":"Statistical Sampling","sidebarTitle":"Statistical Sampling","icon":"dice","href":"/oss/v0-41-0/curation/statistical-sampling"},{"title":"Selective Sampling","sidebarTitle":"Selective Sampling","icon":"crosshairs","href":"/oss/v0-41-0/curation/selective-sampling"},{"title":"Profiling a dataset","sidebarTitle":"Aggregate","icon":"chart-column","href":"/oss/v0-41-0/curation/aggregate"},{"title":"Joining datasets","sidebarTitle":"Join","icon":"link","href":"/oss/v0-41-0/curation/join"},{"title":"Blob Late Materialization","sidebarTitle":"Blob Late Materialization","icon":"clock","href":"/oss/v0-41-0/curation/blob-late-materialization"},{"title":"Distributed Shuffle","sidebarTitle":"Distributed Shuffle","icon":"shuffle","href":"/oss/v0-41-0/curation/distributed-shuffle"},{"title":"Ranking","sidebarTitle":"Ranking","icon":"chart-simple","href":"/oss/v0-41-0/curation/windowing"},{"title":"Cluster records by index partition","sidebarTitle":"Clustering","icon":"circle-nodes","href":"/oss/v0-41-0/curation/clustering"},{"title":"Deduplicate near-duplicate records","sidebarTitle":"Dedupe","icon":"clone","href":"/oss/v0-41-0/curation/dedupe"},{"title":"Scope curation to what changed","sidebarTitle":"Changes","icon":"clock-rotate-left","href":"/oss/v0-41-0/curation/changes"},{"title":"Create a view","sidebarTitle":"Create View","icon":"eye","href":"/oss/v0-41-0/feature-engineering/view"},{"title":"Vend a Secret to a Function","tag":"Early access","sidebarTitle":"Vend Secret","icon":"key","href":"/oss/v0-41-0/curation/vend-secret"}]},{"group":"Feature Engineering","pages":[{"title":"Feature engineering","sidebarTitle":"Overview","icon":"layer-group","href":"/oss/v0-41-0/feature-engineering/index"},{"title":"Create a computed column","sidebarTitle":"Create Computed Column","icon":"table-columns","href":"/oss/v0-41-0/feature-engineering/add-computed-column"},{"title":"Refresh a computed column","sidebarTitle":"Refresh Computed Column","icon":"arrows-rotate","href":"/oss/v0-41-0/feature-engineering/refresh-column"},{"title":"Create a materialized view","sidebarTitle":"Create Materialized View","icon":"table","href":"/oss/v0-41-0/feature-engineering/materialized-views"},{"title":"Refresh a materialized view","sidebarTitle":"Refresh Materialized View","icon":"arrows-rotate","href":"/oss/v0-41-0/feature-engineering/refresh-materialized-view"},{"title":"Incremental Refresh","sidebarTitle":"Incremental Refresh","icon":"arrow-rotate-right","href":"/oss/v0-41-0/enterprise/incremental-refresh"},{"title":"Auto Refresh","sidebarTitle":"Auto Refresh","icon":"clock-rotate-left","href":"/oss/v0-41-0/enterprise/auto-refresh"},{"title":"Function Refresh Checkpointing","tag":"Early access","sidebarTitle":"Checkpointing","icon":"floppy-disk","href":"/oss/v0-41-0/enterprise/checkpointing"},{"title":"Adaptive Execution","tag":"Early access","sidebarTitle":"Adaptive Execution","icon":"gauge-high","href":"/oss/v0-41-0/enterprise/adaptive-execution"},{"group":"Geneva","icon":"layer-group","pages":[{"title":"Multimodal Feature Engineering with Geneva","sidebarTitle":"Overview","icon":"layer-group","href":"/oss/v0-41-0/geneva/index"},{"title":"What is Feature Engineering?","sidebarTitle":"What is feature engineering?","icon":"grip-horizontal","href":"/oss/v0-41-0/geneva/overview/index"},{"title":"Getting Started","sidebarTitle":"Getting Started","icon":"rocket","href":"/oss/v0-41-0/geneva/getting-started"},{"group":"Transforms","pages":[{"title":"Understanding Transforms","sidebarTitle":"Understanding Transforms","icon":"code-compare","href":"/oss/v0-41-0/geneva/udfs/index"},{"title":"User-Defined Functions (UDFs)","sidebarTitle":"UDFs","icon":"function","href":"/oss/v0-41-0/geneva/udfs/udfs"},{"title":"Chunkers (Scalar UDTFs)","sidebarTitle":"Chunkers","icon":"diagram-subtask","href":"/oss/v0-41-0/geneva/udfs/scalar-udtfs"},{"title":"Batch User-Defined Table Functions (UDTFs)","sidebarTitle":"Batch UDTFs","icon":"layer-group","href":"/oss/v0-41-0/geneva/udfs/batch-udtfs"},{"title":"Error Handling in Geneva UDFs","sidebarTitle":"Error Handling","description":"Learn how configure retry, skip, and fail behaviors for UDFs.","icon":"exclamation","href":"/oss/v0-41-0/geneva/udfs/error_handling"},{"title":"Profiling Stateful UDF Memory","sidebarTitle":"Profiling Memory","icon":"chart-line","href":"/oss/v0-41-0/geneva/udfs/profiling-memory"},{"title":"Blob Types in Geneva UDFs","sidebarTitle":"Blobs","description":"Learn how to work with Lance Blobs in Geneva UDFs for handling large binary objects efficiently with lazy reading capabilities.","icon":"splotch","href":"/oss/v0-41-0/geneva/udfs/blobs"}]},{"group":"Built-in Transforms","pages":[{"title":"Built-in LLM and Embedding UDFs","sidebarTitle":"Overview","icon":"sparkles","href":"/oss/v0-41-0/geneva/udfs/providers/index"},{"title":"OpenAI","sidebarTitle":"OpenAI","icon":"brain","href":"/oss/v0-41-0/geneva/udfs/providers/openai"},{"title":"Gemini","sidebarTitle":"Gemini","icon":"google","href":"/oss/v0-41-0/geneva/udfs/providers/gemini"},{"title":"Sentence Transformers","sidebarTitle":"Sentence Transformers","icon":"microchip","href":"/oss/v0-41-0/geneva/udfs/providers/sentence-transformers"}]},{"group":"Running Jobs","pages":[{"title":"Geneva Jobs","sidebarTitle":"Job execution","href":"/oss/v0-41-0/geneva/jobs/index"},{"title":"Backfilling","sidebarTitle":"Backfilling","icon":"fill","href":"/oss/v0-41-0/geneva/jobs/backfilling"},{"title":"Bulk Loading \u0026 Updating Columns","sidebarTitle":"Bulk Load / Update Columns","icon":"columns-3","href":"/oss/v0-41-0/geneva/jobs/bulk-load-columns"},{"title":"Materialized Views with UDFs","sidebarTitle":"Materialized views","icon":"microscope","href":"/oss/v0-41-0/geneva/jobs/materialized-views"},{"title":"Advanced Job Configuration","sidebarTitle":"Advanced job configuration","icon":"sliders","href":"/oss/v0-41-0/geneva/jobs/advanced-job-configuration"},{"title":"Job Lifecycle","sidebarTitle":"Job Lifecycle","icon":"arrows-spin","href":"/oss/v0-41-0/geneva/jobs/lifecycle"},{"title":"Backfill Conflicts","sidebarTitle":"Backfill Conflicts","icon":"code-merge","href":"/oss/v0-41-0/geneva/jobs/conflicts"},{"title":"Distributed Job Performance and Cluster Sizing","sidebarTitle":"Performance and Sizing","icon":"chart-line","href":"/oss/v0-41-0/geneva/jobs/performance"},{"title":"Job Metrics (Diagnostics)","sidebarTitle":"Job Metrics","icon":"chart-simple","href":"/oss/v0-41-0/geneva/jobs/job_metrics"},{"title":"Geneva Console","sidebarTitle":"Console","icon":"computer","href":"/oss/v0-41-0/geneva/jobs/console"},{"title":"Troubleshooting Geneva Jobs","sidebarTitle":"Job troubleshooting","icon":"wrench","href":"/oss/v0-41-0/geneva/jobs/troubleshooting"},{"title":"Advanced Execution Contexts","sidebarTitle":"Advanced execution contexts","icon":"circle-nodes","href":"/oss/v0-41-0/geneva/jobs/contexts"}]},{"group":"Deployment","pages":[{"title":"Deploy Geneva using Helm","sidebarTitle":"Helm Deployment","icon":"cogs","href":"/oss/v0-41-0/geneva/deployment/helm"},{"title":"Job and Session Startup Optimizations","sidebarTitle":"Startup optimizations","icon":"engine","href":"/oss/v0-41-0/geneva/jobs/startup"},{"title":"Dependency Verification","sidebarTitle":"Dependency Verification","icon":"magnifying-glass-chart","href":"/oss/v0-41-0/geneva/deployment/dependency-verification"},{"title":"Advanced Configuration","sidebarTitle":"Advanced Configuration","icon":"flask-gear","href":"/oss/v0-41-0/geneva/udfs/advanced-configuration"},{"title":"Manual Deployment on Kubernetes","sidebarTitle":"Manual Deployment","icon":"cogs","href":"/oss/v0-41-0/geneva/deployment/index"},{"title":"Troubleshooting Geneva Deployments","sidebarTitle":"Deployment Troubleshooting","icon":"question-circle","href":"/oss/v0-41-0/geneva/deployment/troubleshooting"}]},{"title":"End-to-End Example","sidebarTitle":"End-to-end example","icon":"play","href":"/oss/v0-41-0/geneva/end-to-end"},{"title":"Geneva Python SDK","icon":"python","href":"/oss/v0-41-0/geneva/reference"}]}]},{"group":"Training","pages":[{"title":"PyTorch Data Loader","sidebarTitle":"PyTorch Data Loader","icon":"boxes-stacked","href":"/oss/v0-41-0/training/data-loading"},{"title":"Training Cache","sidebarTitle":"Training Cache","icon":"gauge-high","href":"/oss/v0-41-0/training/training-cache"},{"title":"Permutation","sidebarTitle":"Permutation","icon":"shuffle","href":"/oss/v0-41-0/training/permutation"},{"title":"Observability","sidebarTitle":"Observability","icon":"gauge","href":"/oss/v0-41-0/training/observability"},{"title":"Distributed Training","sidebarTitle":"Distributed Training","icon":"server","href":"/oss/v0-41-0/training/distributed-training"},{"title":"Checkpointing","sidebarTitle":"Checkpointing","icon":"floppy-disk","href":"/oss/v0-41-0/training/checkpointing"},{"title":"Resuming","sidebarTitle":"Resuming","icon":"rotate-left","href":"/oss/v0-41-0/training/resuming"}]},{"group":"Management","pages":[{"title":"Management","sidebarTitle":"Overview","icon":"folder-tree","href":"/oss/v0-41-0/management/index"},{"title":"Catalog","sidebarTitle":"Catalog","icon":"sitemap","href":"/oss/v0-41-0/management/catalog"},{"title":"Database","sidebarTitle":"Database","icon":"database","href":"/oss/v0-41-0/management/database"},{"title":"Namespaces","sidebarTitle":"Namespace","icon":"folder-tree","href":"/oss/v0-41-0/management/namespace"},{"title":"Tables","sidebarTitle":"Table","icon":"table","href":"/oss/v0-41-0/management/table"},{"title":"Compress Function output columns","href":"/oss/v0-41-0/enterprise/function-column-compression"},{"title":"Views","sidebarTitle":"View","icon":"eye","href":"/oss/v0-41-0/management/view"},{"title":"Materialized view","sidebarTitle":"Materialized View","icon":"table","href":"/oss/v0-41-0/management/materialized-view"},{"title":"Secret","tag":"Early access","sidebarTitle":"Secret","icon":"key","href":"/oss/v0-41-0/management/secret"},{"title":"Functions","tag":"Early access","sidebarTitle":"Function","icon":"code","href":"/oss/v0-41-0/management/function"},{"title":"Storage Integration","sidebarTitle":"Storage Integration","icon":"cloud","href":"/oss/v0-41-0/management/storage-integration"}]},{"group":"Maintenance","pages":[{"title":"Indexing Data","sidebarTitle":"Overview","icon":"list","href":"/oss/v0-41-0/indexing/index"},{"title":"Intelligent Auto-Maintenance","sidebarTitle":"Intelligent Auto-Maintenance","icon":"brain","href":"/oss/v0-41-0/enterprise/intelligent-auto-maintenance"},{"title":"Vector Indexing","sidebarTitle":"Vector Indexing","icon":"arrow-up-right-dots","href":"/oss/v0-41-0/indexing/vector-index"},{"title":"Full-Text Search (FTS) Indexing","sidebarTitle":"FTS Indexing","icon":"book","href":"/oss/v0-41-0/indexing/fts-index"},{"title":"Scalar Indexing","sidebarTitle":"Scalar Indexing","icon":"tree","href":"/oss/v0-41-0/indexing/scalar-index"},{"title":"Incremental Indexing","sidebarTitle":"Incremental Indexing","icon":"refresh","href":"/oss/v0-41-0/indexing/incremental-indexing"},{"title":"Distributed Indexing","sidebarTitle":"Distributed Indexing","icon":"layer-group","href":"/oss/v0-41-0/enterprise/distributed-indexing"},{"title":"GPU Indexing","sidebarTitle":"GPU Indexing","icon":"microchip","href":"/oss/v0-41-0/indexing/gpu-indexing"},{"title":"Compaction and cleanup","sidebarTitle":"Compaction","icon":"broom","href":"/oss/v0-41-0/maintenance/compaction"},{"title":"Real Time Engine compaction","sidebarTitle":"RTE Compaction","icon":"compress","href":"/oss/v0-41-0/enterprise/realtime-engine-compaction"},{"title":"Distributed Compaction","sidebarTitle":"Distributed Compaction","icon":"compress","href":"/oss/v0-41-0/enterprise/distributed-compaction"},{"title":"Advanced Conflict Resolution","sidebarTitle":"Advanced Conflict Resolution","icon":"shuffle","href":"/oss/v0-41-0/enterprise/advanced-conflict-resolution"},{"title":"Garbage Collection","sidebarTitle":"Garbage Collection","icon":"broom","href":"/oss/v0-41-0/maintenance/cleanup"}]},{"group":"Security","pages":[{"title":"Authentication","sidebarTitle":"Authentication","icon":"key","href":"/oss/v0-41-0/enterprise/authentication"},{"title":"Authorization","sidebarTitle":"Authorization","icon":"shield-halved","href":"/oss/v0-41-0/governance/authorization"},{"title":"Principals","sidebarTitle":"Principals","icon":"user","href":"/oss/v0-41-0/governance/principals"},{"title":"Privileges","sidebarTitle":"Privileges","icon":"key","href":"/oss/v0-41-0/governance/privileges"},{"title":"Audit Log","sidebarTitle":"Audit Log","icon":"clipboard-list","href":"/oss/v0-41-0/governance/audit-log"},{"title":"Compliance","sidebarTitle":"Compliance","icon":"shield-alt","href":"/oss/v0-41-0/enterprise/security"}]},{"group":"Deployment","pages":[{"title":"Horizontal Scaling","sidebarTitle":"Horizontal Scaling","icon":"arrows-left-right","href":"/oss/v0-41-0/enterprise/horizontal-scaling"},{"title":"Monitor LanceDB with OpenTelemetry","sidebarTitle":"OpenTelemetry","icon":"chart-line","href":"/oss/v0-41-0/deployment/opentelemetry"},{"title":"Kubernetes deployment guide","sidebarTitle":"Kubernetes","icon":"cloud","href":"/oss/v0-41-0/enterprise/deployment/kubernetes"},{"title":"Multicloud","sidebarTitle":"Multicloud","icon":"cloud","href":"/oss/v0-41-0/deployment/multicloud"},{"title":"Slurm","sidebarTitle":"Slurm","icon":"server","href":"/oss/v0-41-0/deployment/slurm"}]},{"group":"SQL Reference","pages":[{"title":"SQL reference","sidebarTitle":"Overview","icon":"table-list","href":"/oss/v0-41-0/sql/index"},{"title":"SQL data types","sidebarTitle":"Data Types","icon":"shapes","href":"/oss/v0-41-0/sql/data-types"},{"group":"DDL","icon":"sitemap","pages":[{"title":"Database","sidebarTitle":"Database","icon":"database","href":"/oss/v0-41-0/sql/ddl/database"},{"title":"Namespace","sidebarTitle":"Namespace","icon":"folder-tree","href":"/oss/v0-41-0/sql/ddl/namespace"},{"title":"Table","sidebarTitle":"Table","icon":"table","href":"/oss/v0-41-0/sql/ddl/table"},{"title":"View","sidebarTitle":"View","icon":"eye","href":"/oss/v0-41-0/sql/ddl/view"},{"title":"Materialized View","sidebarTitle":"Materialized View","icon":"table","href":"/oss/v0-41-0/sql/ddl/materialized-view"},{"title":"Secret","tag":"Early access","sidebarTitle":"Secret","icon":"key","href":"/oss/v0-41-0/sql/ddl/secret"},{"title":"Function","tag":"Early access","sidebarTitle":"Function","icon":"function","href":"/oss/v0-41-0/sql/ddl/function"},{"title":"Storage Integration","sidebarTitle":"Storage Integration","icon":"cloud","href":"/oss/v0-41-0/sql/ddl/storage-integration"},{"title":"Index","sidebarTitle":"Index","icon":"bolt","href":"/oss/v0-41-0/sql/ddl/index"},{"title":"Job","sidebarTitle":"Job","icon":"hourglass-half","href":"/oss/v0-41-0/sql/ddl/job"},{"title":"Grant","sidebarTitle":"Grant","icon":"user-lock","href":"/oss/v0-41-0/sql/ddl/grant"}]},{"group":"DML","icon":"database","pages":[{"title":"Insert","sidebarTitle":"Insert","icon":"plus","href":"/oss/v0-41-0/sql/dml/insert"},{"title":"Update","sidebarTitle":"Update","icon":"pen","href":"/oss/v0-41-0/sql/dml/update"},{"title":"Delete","sidebarTitle":"Delete","icon":"trash","href":"/oss/v0-41-0/sql/dml/delete"},{"title":"Copy","sidebarTitle":"Copy","icon":"file-export","href":"/oss/v0-41-0/sql/dml/copy"},{"title":"REFRESH COLUMN","sidebarTitle":"REFRESH COLUMN","icon":"arrows-rotate","href":"/oss/v0-41-0/sql/dml/refresh-column"},{"title":"REFRESH MATERIALIZED VIEW","sidebarTitle":"REFRESH MATERIALIZED VIEW","icon":"arrows-rotate","href":"/oss/v0-41-0/sql/dml/refresh-materialized-view"},{"title":"REFRESH","sidebarTitle":"REFRESH","icon":"arrows-rotate","href":"/oss/v0-41-0/sql/dml/refresh"}]},{"group":"DQL","icon":"filter","pages":[{"title":"SELECT","sidebarTitle":"SELECT","icon":"table-columns","href":"/oss/v0-41-0/sql/dql/select"},{"title":"Subqueries","sidebarTitle":"Subqueries","icon":"code-branch","href":"/oss/v0-41-0/sql/dql/subqueries"},{"title":"Joins","sidebarTitle":"Joins","icon":"link","href":"/oss/v0-41-0/sql/dql/join"},{"title":"Operators and literals","sidebarTitle":"Operators","icon":"plus-minus","href":"/oss/v0-41-0/sql/dql/operators"},{"title":"Functions","sidebarTitle":"Functions","icon":"function","href":"/oss/v0-41-0/sql/dql/functions"},{"title":"Scalar functions","sidebarTitle":"Scalar Functions","icon":"calculator","href":"/oss/v0-41-0/sql/dql/scalar-functions"},{"title":"Aggregation","sidebarTitle":"Aggregation","icon":"layer-group","href":"/oss/v0-41-0/sql/dql/aggregation"},{"title":"Window functions","sidebarTitle":"Window Functions","icon":"chart-simple","href":"/oss/v0-41-0/sql/dql/window"},{"title":"Random sampling","sidebarTitle":"Sampling","icon":"dice","href":"/oss/v0-41-0/sql/dql/sampling"},{"title":"Changes since a version","sidebarTitle":"Changes","icon":"clock-rotate-left","href":"/oss/v0-41-0/sql/dql/changes"},{"title":"Full-Text Search","sidebarTitle":"Full-Text Search","icon":"magnifying-glass","href":"/oss/v0-41-0/sql/dql/fts"},{"title":"CONTAINS_TOKENS","sidebarTitle":"CONTAINS_TOKENS","icon":"magnifying-glass","href":"/oss/v0-41-0/sql/dql/contains-tokens"},{"title":"IVF_PARTITION","sidebarTitle":"IVF_PARTITION","icon":"circle-nodes","href":"/oss/v0-41-0/sql/dql/ivf-partition"},{"title":"DEDUPE","sidebarTitle":"DEDUPE","icon":"layer-group","href":"/oss/v0-41-0/sql/dql/dedupe"},{"title":"DUPLICATE_PAIRS","sidebarTitle":"DUPLICATE_PAIRS","icon":"clone","href":"/oss/v0-41-0/sql/dql/duplicate-pairs"},{"title":"MinHash SQL functions","href":"/oss/v0-41-0/enterprise/sql-minhash"},{"title":"Vector distance functions","sidebarTitle":"Vector Distance","icon":"ruler","href":"/oss/v0-41-0/sql/dql/vector-distance"},{"title":"BLOB_DESCRIPTOR","sidebarTitle":"BLOB_DESCRIPTOR","icon":"file-binary","href":"/oss/v0-41-0/sql/dql/blob-descriptor"},{"title":"GENERATE_SERIES","sidebarTitle":"GENERATE_SERIES","icon":"list-ol","href":"/oss/v0-41-0/sql/dql/generate-series"},{"title":"Explain","sidebarTitle":"Explain","icon":"map","href":"/oss/v0-41-0/sql/dql/explain"}]}]}]},{"tab":"Integrations","pages":[{"title":"Integrations","href":"/oss/v0-41-0/integrations"}]},{"tab":"Tutorials","pages":[{"title":"Tutorials","href":"/oss/v0-41-0/tutorials"}]},{"tab":"Demos","pages":[{"title":"Demos","href":"/oss/v0-41-0/demos"}]},{"tab":"Datasets","pages":[{"title":"Datasets","href":"/oss/v0-41-0/datasets"}]},{"tab":"API Reference","pages":[{"title":"API Reference","href":"/oss/v0-41-0/api-reference/rest"}]}]}]}]},"basePath":"","title":"Profiling Stateful UDF Memory - LanceDB","buildId":"dpl_DqYu5MPb49gWBBbUGgpHQUmCHY3P","deploymentId":"dpl_DqYu5MPb49gWBBbUGgpHQUmCHY3P","dynamics":["10e4515597"],"chunks":["BannerMarkdown-DV3Oq1fY.js","dist-C-XZBk9h.js","lib-DuNMoZ05.js","lib-B8HbPgcC.js","clsx-D3Isdib3.js","html-void-elements-mCSPHezU.js","katex-YMM-FMeD.js","marked.esm-CZWythHk.js"]}