When an object has multiple references to the same child, that child should not be counted multiple times in the memory usage total.
( self )
| 38 | class TestMemoryUsage( unittest.TestCase ) : |
| 39 | |
| 40 | def testMultipleReferences( self ) : |
| 41 | |
| 42 | """When an object has multiple references to the same child, that child |
| 43 | should not be counted multiple times in the memory usage total.""" |
| 44 | |
| 45 | c = IECore.CompoundObject() |
| 46 | d = IECore.IntVectorData( 10000 ) |
| 47 | |
| 48 | c["a"] = d |
| 49 | |
| 50 | m = c.memoryUsage() |
| 51 | dm = d.memoryUsage() |
| 52 | |
| 53 | c["b"] = d |
| 54 | self.assertTrue( c.memoryUsage() < m + dm ) |
| 55 | |
| 56 | def testMultipleReferencesToStringData( self ) : |
| 57 |
nothing calls this directly
no test coverage detected