int deflateEnd(){
    if(status!=INIT_STATE && status!=BUSY_STATE && status!=FINISH_STATE){
      return Z_STREAM_ERROR;
    }
    // Deallocate in reverse order of allocations:
    pending_buf=null;
    l_buf=null;
    head=null;
    prev=null;
    window=null;
    // free
    // dstate=null;
    return status == BUSY_STATE ? Z_DATA_ERROR : Z_OK;
  }