9 Replies Latest reply on Feb 12, 2012 3:32 PM by gouzhun

    Free memory without restarting CityEngine!!

    gouzhun
      Hello,

      I've been working a lot in CityEngine recently, testing out many difference grammar files on the same lot. I've noticed that as I continue doing this, the free memory slowly drops.

      I'm just using the one lot, and only have one model on the screen at any given time.

      Is there a way to free up this memory without having to restart CityEngine:eek:?
        • Re: Free memory without restarting CityEngine!!
          MBuehler-esristaff
          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 ?
          http://resources.arcgis.com/content/cityengine/system-requirements

          Please let me know.
          • Re: Free memory without restarting CityEngine!!
            gouzhun
            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 ?
            http://resources.arcgis.com/content/cityengine/system-requirements

            Please let me know.

            HI,Matthias
            Thx for replying!  My OS is higher than the Software Requirements and Recommendations .I've been working a lot in CityEngine recently,So what you said I have tried,but NOT working!
                I did it by a Python Script which batch exporting my models,Here is the script!
            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][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')

            Any problem with it!?:)
            • Re: Free memory without restarting CityEngine!!
              MBuehler-esristaff
              hi !

              I was not aware you're working with the Exporter. I asked one of the devs and it seems there may be some sort of mem leak in the Exporter, especially when called multiple times in a batch process.

              We're aware of the issue and try to fix this asap.
              • Re: Free memory without restarting CityEngine!!
                gouzhun
                OK,Thx!
                The 2011.1 release had solved this problem,Right??
                • Re: Free memory without restarting CityEngine!!
                  MBuehler-esristaff
                  hi.

                  for 2011.1, we have indeed fixed a mem leak, but not sure if it's your one.

                  if you're on 2010.3, go to preferences/general/grammar core and disable the RCP Logger.

                  does this help ?

                  let me know.
                  • Re: Free memory without restarting CityEngine!!
                    gouzhun
                    Hi,Matthias!
                    I have disabled the RCP Logger ,but still memory leak!
                    • Re: Free memory without restarting CityEngine!!
                      MBuehler-esristaff
                      hi !

                      is it possible that you prepare me a little simplified CE project which let's me reproduce the issue here , click-n-go style .. ?

                      please send it to me directly (matthias.buehler@procedural.com) ?

                      & please let me know which precise OS you're working on.
                      • Re: Free memory without restarting CityEngine!!
                        SHaegler-esristaff
                        hi

                        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.

                        kind regards,
                        simon
                        • Re: Free memory without restarting CityEngine!!
                          gouzhun
                          hi

                          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.

                          kind regards,
                          simon

                          Hi,Simon!
                          The memory LEAK really makes me upset,hoping you fix it asap!

                          gouzhun