From 9612e41cf7d03a5b26afb0457f34906eec3b09bb Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Sun, 27 Aug 2023 17:49:21 +0800 Subject: [PATCH] :art: Limit memory usage of PDF parsing https://github.com/siyuan-note/siyuan/pull/9051 --- kernel/model/asset_content.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kernel/model/asset_content.go b/kernel/model/asset_content.go index 3ca46da21..3a92bac84 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 }