Hi Gou !
Can you tell me precisely what OS you are using (amount of RAM / 32|64 bit / ..) ?
The CityEngine caches (keeps in memory) assets and textures, thus it may be if you are frequently exchanging assets that your memory decreases. What may also help you is to delete from time to time the existing models via RMB > Delete Models.
Did you see the recommended (and minimum) system requirements here ?
Please let me know.
import os,sys def list_file(rootpath): i=0 for path in os.listdir(rootpath): absolutepath=os.path.join(rootpath,path) if os.path.isdir(absolutepath): list_file(absolutepath) else: if os.path.splitext(path)[1:] =="shp": ImportAndGenerate(rootpath+"\\"+path,i,path[0:3]) i=i+1 def ImportAndGenerate(pathstr,i,path): ce.importFile(pathstr, settings) object = ce.getObjectsFrom(ce.scene, ce.withName("'Shapefile Lot'")) ce.setSelection(object) ce.setStartRule(ce.selection, "Lot") #object=ce.getObjectsFrom(ce.selection) ce.setRuleFile(ce.selection, "rules\ForExport\GroundFLoorExport.cga") #ce.generateModels(object) #ce.saveFile("rt.cej") #ce.generateModels(object) Export(object,path+str(i)) def Export(object,Namestr): exportPath = ce.toFSPath("models/") exportSettings = A3DSExportModelSettings() exportSettings.setGranularityFile(A3DSExportModelSettings.PER_INITIAL_SHAPE) exportSettings.setGeneralLocation(exportPath) exportSettings.setGeneralName(Namestr) ce.export(object, exportSettings) ce.delete(ce.getObjectsFrom(ce.scene)) if __name__ == '__main__': ce.newFile("rt.cej") ce.openFile("rt.cej") settings=SHPImportSettings() settings.setProjection(SHPImportSettings.DisableProjection) list_file('E:\\cityOP\\TDMap\\data\\OUT')
we have analyzed your shapefiles and scripts. there are two things to note:
1) CityEngine uses the java memory management. this means that CityEngine can allocate up to a certain amount of memory for all scene objects. this is specified in CityEngine.ini with the "-Xmx700M" switch. only when this amount is filled up, the java garbage collector will start to remove unused memory, for example when the python script imports another shape file.
this explains the behaviour you see on your system: although your memory indicator shows that CityEngine has used a lot of memory, it is still available inside CityEngine for further operations.
note that models generated by CGA and the model exporter operate outside the java memory.
2) in CityEngine 2010.3 and CityEngine 2011 there is indeed a memory leak when a scene is closed or a new scene is created. we have logged the issue and will try to fix it for the next service release.
we are sorry for the inconvenience.