implement function allocate_page()