Commit 0c05436cef6f65cb2d62c8764522abefeb964314 introduced OBJ_SHARED_REFCOUNT and makeObjectShared, which act to disable reference-counting for shared integers. This seems to have been added to prevent concurrency issues with the reference count, since the shared integers may be accessed from both the main thread and the lazy-free thread.

It seems to me it would be a good idea to mark all objects in the global sharedObjectsStruct (struct sharedObjectsStruct shared in server.c) with this property, as conceptually they should live for the entire lifetime of the process and should never be freed. This can prevent bugs in the reference-counting from causing global objects to be accidentally freed and later overwritten, which would probably be a really difficult problem to debug. It would also remove unnecessary memory-write operations, though the performance improvement is probably negligible.

Comment From: oranagra

i'm generally in favor, but i dislike the blame log damage (and merge conflicts for forks, backports and old PRs) without a real justification and benefit. i'd say we go for this only if we actually find a real improvement or issue fixed.