@classmethod
def set_allocator(cls, alloc_func):
    """Set an allocator for this class; allows to instantiate statically
        sized MemTypes (i.e. sizeof() is implemented) without specifying the
        address (the object is allocated by @alloc_func in the vm).

        You may call set_allocator on specific MemType classes if you want
        to use a different allocator.

        @alloc_func: func(VmMngr) -> integer_address
        """
    cls.allocator = alloc_func
