Skip to content

Qustion about reachability fence and code paths #275

@stroomdev66

Description

@stroomdev66

I assume that it doesn't matter that not all code paths hit the reachability fence. Is the presence of them at the end of the method all that is needed to stop premature GC?

e.g.

    final Pointer transientKey = txn.kv().keyIn(key);
    final Pointer transientVal = txn.kv().valIn(val);
    final int mask = mask(true, flags);
    final int rc =
            LIB.mdb_put(txn.pointer(), ptr, txn.kv().pointerKey(), txn.kv().pointerVal(), mask);
    if (rc == MDB_KEYEXIST) {
      if (isSet(mask, MDB_NOOVERWRITE)) {
        txn.kv().valOut(); // marked as in,out in LMDB C docs
      } else if (!isSet(mask, MDB_NODUPDATA)) {
        checkRc(rc);
      }
      return false;
    }
    checkRc(rc);
    ReferenceUtil.reachabilityFence0(transientKey);
    ReferenceUtil.reachabilityFence0(transientVal);
    ReferenceUtil.reachabilityFence0(key);
    ReferenceUtil.reachabilityFence0(val);

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionQueries on usage of the library, architectural patterns and alike

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions