Message-ID: From: "progmachine (@progmachine)" To: "postgresql-interfaces/psqlodbc" Date: Tue, 14 May 2024 07:04:25 +0000 Subject: Re: [postgresql-interfaces/psqlodbc] issue #8: Memory leaks detected in psqlodbc library In-Reply-To: References: List-Id: X-GitHub-Author-Login: progmachine X-GitHub-Comment-Id: 2109434635 X-GitHub-Comment-Type: issue_comment X-GitHub-Edited-At: 2024-05-14T08:13:28Z X-GitHub-Issue: 8 X-GitHub-Repo: postgresql-interfaces/psqlodbc X-GitHub-Type: comment X-GitHub-Url: https://github.com/postgresql-interfaces/psqlodbc/issues/8#issuecomment-2109434635 Content-Type: text/plain; charset=utf-8 > ... and still self->ntables is set to 0 suggesting that there are no tables in the ConnectionClass object `CC_clear_col_info` function makes exactly that: `ConnectionClass` object will not have any cached `COL_INFO` objects, after it's called. > All I see is that if refcount is not zero they are skipped refcnt lifetime management works like that - if refcnt is not zero then somewhere also is reference to object exist, and object must be destroyed somewhere else, where refcnt will be 0. `std::shared_ptr` in C++ works with the same principle. I strongly suspect, that this refcnt mechanize is broken, and `destroy` function parameter used in `if` statement alongside with refcnt, is a crutch, designed to avoid rude memory leaks, while working by standard way.