code: def __init__(self, size=mmap.PAGESIZE):
      self._lastpid = os.getpid()
      self._lock = threading.Lock()
      # Current arena allocation size
      self._size = size
      # A sorted list of available block sizes in arenas
      self._lengths = []
  
      # Free block management:
      # - map each block size to a list of `(Arena, start, stop)` blocks
      self._len_to_seq = {}
      # - map `(Arena, start)` tuple to the `(Arena, start, stop)` block
      #   starting at that offset
      self._start_to_block = {}
      # - map `(Arena, stop)` tuple to the `(Arena, start, stop)` block
      #   ending at that offset
      self._stop_to_block = {}
  
      # Map arenas to their `(Arena, start, stop)` blocks in use
      self._allocated_blocks = defaultdict(set)
      self._arenas = []
  
      # List of pending blocks to free - see comment in free() below
      self._pending_free_blocks = []
  
      # Statistics
      self._n_mallocs = 0
      self._n_frees = 0
  
imports: import bisect
  from collections import defaultdict
  import mmap
  import os
  import sys
  import tempfile
  import threading
  from .context import reduction, assert_spawning
  from .None import util
label_desc: Use image node_id 1 to create a new Heap object from inherited base classes: object with example: obj = Heap(size)