您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 

37 行
1.1 KiB

  1. @cython.final
  2. @cython.internal
  3. cdef class _MemDebug:
  4. """Debugging support for the memory allocation in libxml2.
  5. """
  6. def bytes_used(self):
  7. """bytes_used(self)
  8. Returns the total amount of memory (in bytes) currently used by libxml2.
  9. Note that libxml2 constrains this value to a C int, which limits
  10. the accuracy on 64 bit systems.
  11. """
  12. return tree.xmlMemUsed()
  13. def blocks_used(self):
  14. """blocks_used(self)
  15. Returns the total number of memory blocks currently allocated by libxml2.
  16. Note that libxml2 constrains this value to a C int, which limits
  17. the accuracy on 64 bit systems.
  18. """
  19. return tree.xmlMemBlocks()
  20. def dict_size(self):
  21. """dict_size(self)
  22. Returns the current size of the global name dictionary used by libxml2
  23. for the current thread. Each thread has its own dictionary.
  24. """
  25. c_dict = __GLOBAL_PARSER_CONTEXT._getThreadDict(NULL)
  26. if c_dict is NULL:
  27. raise MemoryError()
  28. return tree.xmlDictSize(c_dict)
  29. memory_debugger = _MemDebug()