~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.
The PDF cache release added in #6459 now logs a WARNING the first time a library's releaser (pdfminer under pdfplumber, or pypdf) has to switch itself off in a process — at most one per library, for example after an upgrade changed the internals it relies on — since the memory held between pages is no longer bounded from then on; later occurrences stay at DEBUG. Its memory estimate also leaves less uncounted: every object a page caches counts for at least one element, so empty and scalar objects are no longer free; a stream's dictionary counts like any other parsed dictionary, read without decoding the stream (before, a stream counted one element, so a Form XObject whose dictionary holds hundreds of thousands of empty arrays cost up to about 85 times its file bytes uncounted: 300,000 of them, a 600 KB file, held 49 MB); the objects pdfminer parses out of object streams now count too, each once, including those no page has resolved yet; and so do the fonts pdfminer builds, which were not counted at all — counted as pdfminer's get_font() returns them rather than read off its font cache, so a font written inline in a resource dictionary, which pdfminer does not cache and builds again on every use (on every page, and on every invocation of a Form XObject), counts each time it is built: one element per font plus every element nested in the tables the build stores on it — its /ToUnicode map, its encoding table, its widths and a CID font's vertical displacements (a table several fonts share counts once, and one that a parsed object or pdfminer itself still holds, such as the font's descriptor or the items of a Type 3 font's /FontMatrix, which a build stores as they are, is not counted or walked again while that holds it: walking it on every build, as the previous revision did once the tables it held reached the threshold's worth, made a page of 100 Dos of a form whose inline font's descriptor holds 600,000 empty arrays take about 66 s of CPU, and about 130 s with them as a /FontMatrix item, against about 3 s without the releaser; it now takes about 6.3-6.7 s, the extra being one release and its collection) — and the decoded bytes it feeds to a parser pdfminer leaves in a reference cycle. Each font, simple ones included, builds its own widths table, copying its /Widths array even when many fonts share one: before that copy counted, 6 pages of six fonts sharing one 200,000-entry array grew about 97 MB per page with no release. A Type 1 font without /Encoding parses a fresh copy of its /FontFile's first /Length1 bytes, which its parser keeps in a reference cycle: before that copy counted, three fonts a page sharing a 20 MB /FontFile of spaces (a ~30 KB file) grew about 57 MB per page with no release, 706 MB over 12 pages; both now stay flat, each page releasing. A CID font also joins its /CIDSystemInfo /Registry and /Ordering into a new string on every build, however long they are and however many fonts share them: ten pages of five such fonts sharing a 20 MB /Registry string (a 25 KB file) grew about 95 MB per page with the estimate at 0.1 MB and no release, about 1 GB over 10 pages; every string a font build stores, and every string in a parsed object (dictionary keys included: pdfminer turns a name that is not UTF-8 into the text of its repr, about four characters a byte), now counts by its size, and that file stays flat, about 19 MB above the starting memory between pages. Because each such allocation went unbounded until it was found, the release also has a measured trigger: on Linux, where the process's resident memory can be read from /proc/self/statm, both walk releasers also release once it has grown by the threshold since the last release (or since the walk began), whatever the estimate says, and the pdfplumber walk also runs a collection in the middle of a page once it has grown by the threshold since the last collection; a read that fails keeps the previous baseline rather than switching the trigger off. With the string counting removed, the measured trigger alone holds the /Registry file at about 182 MB above the start between pages. The resident memory is the whole process's, so growth from other threads, or that a release cannot free, makes a release that frees nothing, and the next one waits for another threshold's worth of growth; on other platforms only the estimate applies. Because those parsers are garbage once the build returns, the walk also runs a full garbage collection, between releases and in the middle of a page, once the bytes fed to them could hold the threshold's worth (the tokens a crafted input leaves on their stack hold up to about 170 bytes per decoded byte) and when the font tables it holds reach the threshold's worth and are let go of: a page invoking a Form XObject of five inline 65,536-entry /ToUnicode fonts 20 times took the process to about 880 MB before and about 110 MB now. Those bytes count only where pdfminer parses them — the /FontFile header copy is its first /Length1 bytes, and nothing for a font with /Encoding or with one of the standard /BaseFont names pdfminer has built-in metrics for — and a collection asked for in the middle of a page waits until the walking thread has spent nine times the last collection's duration since it ended, so that such collections take at most about a tenth of its CPU time, unless the resident memory has grown by four times the threshold; a release is spaced the same way (one the resident memory asks for waits, and one the estimate asks for drops the caches at once but defers its collection) — except that a collection runs at once, however recent the last one, once the garbage that only a collection frees, released since the last one, reaches the threshold: what those parsers were fed, which each keeps (a fresh copy, such as the /FontFile header, at once; a stream's own decoded bytes, once each, when the release rewinds the stream), and the tables of the fonts built with them, such as a /ToUnicode map, once those fonts are dropped (an inline font's when its build returns, a cached font's at the release). An earlier revision of this change spaced those too, holding them for as long as nine full collections of the server process's heap took: 40 pages of five fonts sharing a 65,536-entry /ToUnicode map peaked about 400 MB above the starting memory with 8 million objects held (about 430 MB without the resident-memory trigger, as on macOS or Windows), and it now peaks at 51-74 MB with 0 to 8 million objects held, with or without that trigger, as when every release collected (44-72 MB). What a deferred collection would still free, the part of the parsers' residue the worst-case factor counts beyond what each was fed, is held until it runs, for longer the more objects the process holds (on Linux at most until the resident memory has grown by four times the threshold); a collection still deferred when the walk ends runs then, as the releaser is let go of (or on its close()), and none of the honest documents measured deferred one. After a font build that raised, the streams it may have parsed are looked up in the object cache only, so that the count parses nothing the build did not reach and follows no reference cycle. Before, counting the whole decoded /FontFile on every build made a 1.3 KB page of 2,000 Dos of a form with one inline Type 1 font whose /Length1 is 0 run 2,001 collections: about 141 s of CPU instead of about 0.45 s without the releaser, with a million objects held; it now runs none (0.58 s). With /Length1 the whole 400 KB of spaces, which the worst-case factor over-counts, it ran 2,001 collections (191 s against 4.7 s) and now 11 (6.2 s). A release the estimate asks for can be as cheap: 100 pages whose font decodes a shared 64 MB /FontFile of zeros and parses none of it (a 92 KB file) release on every page, and with a million objects held ran 101 collections (about 25 s of CPU) and now 25 (about 20 s, the rest being the stream decoded again on every page), at the same peak memory. One of eight honest documents of 1 to 500 pages released once (a one-page form whose three embedded TrueType fonts grew the process by about 69 MB); none triggered a collection otherwise, at unchanged CPU time. Before, an 18 KB PDF of 20 pages, each with five fonts sharing one ~100-byte compressed /ToUnicode CMap that maps codes 0000-FFFF, held about 840 MB with the estimate at 64 KB and no release (about 21 GB at the 500-page ceiling, extrapolated), and 20 pages of five CID fonts whose /W [0 65535 500] expands to 65,536 widths each held about 450 MB, also with no release. Counting only the cached fonts, as an earlier revision of this change did, missed inline ones: the same five fonts written inline (a 13 KB file) still held about 840 MB over 20 pages with no release, and so did five inline fonts in a Form XObject; one inline font whose four-byte /ToUnicode range maps 262,144 codes (a 7 KB file) grew about 34 MB per page. A pdfminer release also frees what it drops now (the releaser holds the font tables it has counted while something else holds them, and up to the threshold's worth of those nothing else does, until then): the parser that builds a font's /ToUnicode map keeps the map and the decoded CMap bytes in a reference cycle, which the release used to leave for an automatic collection that such pages hardly trigger, so a walk whose shared /ToUnicode CMap decoded to 70 MB, enough to make every page release, still grew about 850 MB over 12 pages; the release now runs a full garbage collection (about 0.06 s per million objects the process holds, counted against the CPU budget), spaced as above. Measured between pages, with 0, 3 or 8 million other objects held and with the resident-memory trigger on or off, the /ToUnicode file now peaks 44-74 MB above the starting memory, at 20, 40 and 60 pages alike, the CID /W file 34-35 MB and the 70 MB-CMap file 33-45 MB, and over 20 pages the inline /ToUnicode file 47-69 MB, its Form XObject variant 19-64 MB and the four-byte one about 43 MB. pdfminer's process-wide tables of the names and keywords it has parsed (PSLiteralTable, PSKeywordTable) are not bounded: it never clears them and compares against their entries by identity, so the release cannot drop them, and a 2 MB PDF of a million distinct names or keywords adds about 175 MB to the server process for good, each upload of new ones more (the honest documents measured added 25 to 243 entries each).