@classmethod
def alloc(cls, vm, size):
    """Returns an allocated page of size @size if cls.allocator is set.
        Raises ValueError otherwise.
        """
    if cls.allocator is None:
        raise ValueError(
            'Cannot provide None address to MemType() if%s.set_allocator has not been called.'
             % __name__)
    return cls.allocator(vm, size)
