From c4a235167045565c7d396f184f6a7170d9d0f0c5 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Sat, 9 Feb 2002 05:01:35 +0000 Subject: [PATCH] Broke memory loops on creating a new database, fixing memory allocation problems in python 1.5.2. svn: r764 --- src/RelLib.py | 20 ++++++++++++++++++-- src/docgen/OpenOfficeDoc.py | 6 +++--- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/src/RelLib.py b/src/RelLib.py index e04c0a255..9ce4325f4 100644 --- a/src/RelLib.py +++ b/src/RelLib.py @@ -1639,12 +1639,16 @@ class RelDataBase: def __init__(self): """creates a new RelDataBase""" - self.new() self.iprefix = "I%d" self.sprefix = "S%d" self.oprefix = "O%d" self.pprefix = "P%d" self.fprefix = "F%d" + self.familyMap = {} + self.personMap = {} + self.sourceMap = {} + self.placeMap = {} + self.new() def set_iprefix(self,val): if _id_reg.search(val): @@ -1678,8 +1682,20 @@ class RelDataBase: def new(self): """initializes the RelDataBase to empty values""" - self.personMap = {} + + # eliminate memory reference cycles for 1.5.2 garbage collection + for f in self.familyMap.values(): + f.Father = None + f.Mother = None + f.Children = [] self.familyMap = {} + + for p in self.personMap.values(): + p.MainFamily = None + p.AltFamilyList = None + p.FamilyList = None + self.personMap = {} + self.sourceMap = {} self.placeMap = {} self.objectMap = {} diff --git a/src/docgen/OpenOfficeDoc.py b/src/docgen/OpenOfficeDoc.py index 049a5f388..7f17e9445 100644 --- a/src/docgen/OpenOfficeDoc.py +++ b/src/docgen/OpenOfficeDoc.py @@ -202,7 +202,8 @@ class OpenOfficeDoc(TextDoc): self.f.write(' style:parent-name="Graphics">') self.f.write('