code: def test_ownership(self):
      # see https://github.com/facebookresearch/faiss/issues/2996
      subset = np.arange(0, 50)
      sel = faiss.IDSelectorBatch(subset)
      self.assertTrue(sel.this.own())
      params = faiss.SearchParameters(sel=sel)
      self.assertTrue(sel.this.own())  # otherwise mem leak!
      # this is a somewhat fragile test because it assumes the
      # gc decreases refcounts immediately.
      prev_count = sys.getrefcount(sel)
      del params
      new_count = sys.getrefcount(sel)
      self.assertEqual(new_count, prev_count - 1)
  
      # check for other objects as well
      sel1 = faiss.IDSelectorBatch([1, 2, 3])
      sel2 = faiss.IDSelectorBatch([4, 5, 6])
      sel = faiss.IDSelectorAnd(sel1, sel2)
      # make storage is still managed by python
      self.assertTrue(sel1.this.own())
      self.assertTrue(sel2.this.own())
  
imports: import numpy
  import faiss
  import unittest
  import sys
  import gc
  from faiss.contrib import datasets
  from faiss.contrib.evaluation import sort_range_res_2, check_ref_range_results
label_desc: Use image node_id 7 for calling the TestSearchParams obj's underlying member method code with example usage: obj.test_ownership() without return types