Reduce memory leaks when switching credocuments
CRE cache, hyphdict and fonts can be initialized only once when first credocument is opened. Previously, they were recreated for each document, and as previous instances were probably not free'd, this caused memory leaks.
This commit is contained in:
1 parent
96ea2ece96
commit
495accfec9
2 files changed
+10
-3
No files matched your search
@@ -28,6 +28,11 @@ function DocumentRegistry:getProvider(file)
|
||||
end
|
||||
|
||||
function DocumentRegistry:openDocument(file)
|
||||
-- force a GC, so that any previous document used memory can be reused
|
||||
-- immediately by this new document without having to wait for the
|
||||
-- next regular gc. The second call may help reclaming more memory.
|
||||
collectgarbage()
|
||||
collectgarbage()
|
||||
if not self.registry[file] then
|
||||
local provider = self:getProvider(file)
|
||||
if provider ~= nil then
|
||||
|
||||
Reference in new issue
Block a user