* @return the object or the already erased dereferenced object
     */
    public static PdfObject killIndirect(final PdfObject obj) {
        if (obj == null || obj.isNull())
            return null;
        PdfObject ret = getPdfObjectRelease(obj);
        if (obj.isIndirect()) {
            PRIndirectReference ref = (PRIndirectReference)obj;
            PdfReader reader = ref.getReader();
            int n = ref.getNumber();
            reader.xrefObj.set(n, null);
            if (reader.partial)
                reader.xref[n * 2] = -1;
        }
        return ret;
    }