out of memory....


I installed the latest build: Panda3D-SDK-1.10.0pres-65ae1e1-py3.6-x64. I use windows 7 pro 64 bits and have 8GB memory installed. When I run my application, it crashes with an “out of memory allocating 262160 bytes” error. Before yesterday, I used the version from 10 nov. 2015, also 64 bits and version 1.10. In that version of Panda this out of memory error does not occur. When the error occurs, used memory is 2.88 GB, while I have 8 GB installed, so there obviously is more than enough memory available.

Does the latest build use more memory, or maybe the python version 3.6?

The memory error occurs after a flattenstrong operation. I divide the database in a 2 dimensional array with tiles of,for example 250 meters, length and width. All objects within that area are reparented to that tile and flattenStrong is called on that group of objects. When I have a number of larger 3d objects (houses in this case), there’s this memory error. As long as the individual objects are small (in bytes) this does not occur. But the amount of memory used is stll far below the available amount of memory.

Here’s the code where this occurs:

    def flattenTileTableLow(self, numrowsLow, numcolsLow, np):    
        for row in range(numrowsLow):
           for col in range(numcolsLow):
              newnp = self.tiletableLow[row][col]
              if newnp.getNumChildren() > 0:
                 bounds = newnp.getBounds()
                 if not bounds.isEmpty():
                    x = newnp.getBounds().getCenter().getX()
                    y = newnp.getBounds().getCenter().getY() 
                    fn = FadeLODNode('lod_tilenode')
                    lodNode = NodePath(fn)
                    lodNode.node().setCenter((x, y, 0.0))
                    lodNode.node().addSwitch(self.switchdistLow+0.5*self.tilesizeLow, 0.0)
                    self.tiletableLow[row][col] = lodNode
                  else: newnp.removeNode()  
              else: newnp.removeNode()
        print("table Low created....")

and self.tiletableLow is created as follows:

        self.tiletableLow = []
        for row in range(numrowsLow):
           for col in range(numcolsLow):
               newnp = NodePath("tilenode")

In the previous version of panda (from 10-11-2015) I never had this memory error, so it looks as if the available amount of memory for flattening is more limited now.

I checked the previous 1.10 versions of Panda:

  • the version of 30-3-2017: Panda3D-SDK-1.10pre-5050aae-py3.5-x64.exe works okay: all tiles are flattenedStrong
  • the version of 7-4-2017: Panda3D-SDK-1.10pre-97cd007-x64.exe is the first one where this memory problem occurs. All versions after this have this problem.

When I replace newnp.flattenStrong() with newnp.flattenMedium(), there’s no memory error so that’s a reasonable workaround for me.

Do you think you could send me a runnable piece of code so I can reproduce the issue on my machine?

I have just sent you a PM with a runnable piece of code + test database.

In the prc file I have the following:
max-collect-vertices 524280
max-collect-indices 524280

If I remove these, the crash in the flattenStrong() command for higher poly models is solved…


I ran your code and encountered a crash. This was caused by a missed edge case in the unify call. Could you check whether the latest development version (4fae819, or later such as 114aee1) fixes the problem?

I have checked version 4fae819. Now is works fine so its solved. Thank you.