Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: Limit memory usage of PDF parsing https://github.com/siyuan-note/siyuan/pull/9051

Daniel9612e41cf7d0
diff --git a/kernel/model/asset_content.go b/kernel/model/asset_content.go
index 3ca46da211..3a92bac841 100644
--- a/kernel/model/asset_content.go
+++ b/kernel/model/asset_content.go
@@ -861,12 +861,12 @@ func (parser *PdfAssetParser) Parse(absPath string) (ret *AssetParseResult) {
}
// loop through ordered PDF text pages and join content for asset parse DB result
- content := ""
+ contentBuilder := bytes.Buffer{}
for _, pt := range pageText {
- content += " " + normalizeNonTxtAssetContent(pt)
+ contentBuilder.WriteString(" " + normalizeNonTxtAssetContent(pt))
}
ret = &AssetParseResult{
- Content: content,
+ Content: contentBuilder.String(),
}
return
}