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:
newnp.clearModelNodes()
newnp.flattenStrong()
bounds = newnp.getBounds()
if not bounds.isEmpty():
x = newnp.getBounds().getCenter().getX()
y = newnp.getBounds().getCenter().getY()
fn = FadeLODNode('lod_tilenode')
fn.setFadeTime(2.0)
lodNode = NodePath(fn)
lodNode.reparentTo(np)
lodNode.node().setCenter((x, y, 0.0))
lodNode.node().addSwitch(self.switchdistLow+0.5*self.tilesizeLow, 0.0)
newnp.reparentTo(lodNode)
self.tiletableLow[row][col] = lodNode
lodNode.prepareScene(base.win.getGsg())
else: newnp.removeNode()
else: newnp.removeNode()
print("table Low created....")
and self.tiletableLow is created as follows:
self.tiletableLow = []
for row in range(numrowsLow):
self.tiletableLow.append([])
for col in range(numcolsLow):
newnp = NodePath("tilenode")
self.tiletableLow[row].append(newnp)
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.
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.
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?