Broke memory loops on creating a new database, fixing memory allocation

problems in python 1.5.2.


svn: r764
This commit is contained in:
Don Allingham 2002-02-09 05:01:35 +00:00
parent 4a76aaa63c
commit 6210114b6e
2 changed files with 21 additions and 5 deletions

View File

@ -1639,12 +1639,16 @@ class RelDataBase:
def __init__(self): def __init__(self):
"""creates a new RelDataBase""" """creates a new RelDataBase"""
self.new()
self.iprefix = "I%d" self.iprefix = "I%d"
self.sprefix = "S%d" self.sprefix = "S%d"
self.oprefix = "O%d" self.oprefix = "O%d"
self.pprefix = "P%d" self.pprefix = "P%d"
self.fprefix = "F%d" self.fprefix = "F%d"
self.familyMap = {}
self.personMap = {}
self.sourceMap = {}
self.placeMap = {}
self.new()
def set_iprefix(self,val): def set_iprefix(self,val):
if _id_reg.search(val): if _id_reg.search(val):
@ -1678,8 +1682,20 @@ class RelDataBase:
def new(self): def new(self):
"""initializes the RelDataBase to empty values""" """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 = {} self.familyMap = {}
for p in self.personMap.values():
p.MainFamily = None
p.AltFamilyList = None
p.FamilyList = None
self.personMap = {}
self.sourceMap = {} self.sourceMap = {}
self.placeMap = {} self.placeMap = {}
self.objectMap = {} self.objectMap = {}

View File

@ -202,7 +202,8 @@ class OpenOfficeDoc(TextDoc):
self.f.write(' style:parent-name="Graphics">') self.f.write(' style:parent-name="Graphics">')
self.f.write('<style:properties style:vertical-pos="from-top"') self.f.write('<style:properties style:vertical-pos="from-top"')
self.f.write(' style:vertical-rel="paragraph"') self.f.write(' style:vertical-rel="paragraph"')
self.f.write(' style:horizontal-pos="from-left" syle:horizontal-rel="paragraph"') self.f.write(' style:horizontal-pos="from-left"')
self.f.write(' style:horizontal-rel="paragraph"')
self.f.write(' style:mirror="none" fo:clip="rect(0cm 0cm 0cm 0cm)"') self.f.write(' style:mirror="none" fo:clip="rect(0cm 0cm 0cm 0cm)"')
self.f.write(' draw:luminance="0%" draw:contrast="0" draw:red="0%"') self.f.write(' draw:luminance="0%" draw:contrast="0" draw:red="0%"')
self.f.write(' draw:green="0%" draw:blue="0%" draw:gamma="1"') self.f.write(' draw:green="0%" draw:blue="0%" draw:gamma="1"')
@ -307,8 +308,7 @@ class OpenOfficeDoc(TextDoc):
if os.path.isfile(self.filename): if os.path.isfile(self.filename):
os.unlink(self.filename) os.unlink(self.filename)
os.system("cd " + self.tempdir + "; " + const.zipcmd + " " \ os.system("cd %s; %s %s ." % (self.tempdir,const.zipcmd,self.filename))
+ self.filename + " .")
os.unlink(self.tempdir + os.sep + "META-INF" + os.sep + "manifest.xml") os.unlink(self.tempdir + os.sep + "META-INF" + os.sep + "manifest.xml")
os.unlink(self.tempdir + os.sep + "content.xml") os.unlink(self.tempdir + os.sep + "content.xml")