Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-26 08:02:36

0001 # This file is part of the ACTS project.
0002 #
0003 # Copyright (C) 2016 CERN for the benefit of the ACTS project
0004 #
0005 # This Source Code Form is subject to the terms of the Mozilla Public
0006 # License, v. 2.0. If a copy of the MPL was not distributed with this
0007 # file, You can obtain one at https://mozilla.org/MPL/2.0/.
0008 
0009 import gc
0010 import weakref
0011 
0012 import detray.core
0013 import detray.tests
0014 
0015 
0016 def test_detector_keeps_memory_resource_alive():
0017     memory_resource = detray.core.HostMemoryResource()
0018     mr_ref = weakref.ref(memory_resource)
0019 
0020     det, names = detray.tests.buildToyDetector(
0021         memory_resource, detray.tests.ToyDetectorConfig()
0022     )
0023 
0024     del memory_resource
0025     gc.collect()
0026 
0027     assert mr_ref() is not None
0028 
0029     del det, names
0030     gc.collect()
0031 
0032     assert mr_ref() is None