You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

test_allocator.py 552 B

1234567891011121314151617181920212223242526
  1. # Copyright 2020 Tencent
  2. # SPDX-License-Identifier: BSD-3-Clause
  3. import pytest
  4. import ncnn
  5. def test_pool_allocator():
  6. pa = ncnn.PoolAllocator()
  7. assert pa is not None
  8. pa.set_size_compare_ratio(0.5)
  9. buf = pa.fastMalloc(10 * 1024)
  10. assert buf is not None
  11. pa.fastFree(buf)
  12. pa.clear()
  13. def test_unlocked_pool_allocator():
  14. upa = ncnn.UnlockedPoolAllocator()
  15. assert upa is not None
  16. upa.set_size_compare_ratio(0.5)
  17. buf = upa.fastMalloc(10 * 1024)
  18. assert buf is not None
  19. upa.fastFree(buf)
  20. upa.clear()