|ext:with-pinned-object (object &key :inhibit-write-protection) &body body||[Macro]|
Pin the address of the object in the lisp heap while the body executes. This prevents the garbage collector moving the object while the body executes.
When the inhibit-write-protection argument is true, which is the default, all pages touched by the object have their write protection cleared. This is necessary if foreign code will be writing to the object to avoid foreign code clashing with the garbage collector. The garbage collector will not set page write protection of pinned objects once cleared. If a pinned object is only accessed from lisp code, or only read by foreign code then it is not necessary to clear write protection.