On 2022/08/31 11:42, 钱海远(Nathan) wrote: > Yes, when I was free svn_error_t's pool , no memory leak. > > Why svn_error_t create a new memory pool , not use pool ? > > svn_error_t *err = svn_fs_node_id(id, *root, *path_relative, pool); > if(err != SVN_NO_ERROR || !id ) > { > if(err != SVN_NO_ERROR) > svn_pool_destroy(err->pool);
Because we can't determine which pool to be used other than global pool, for the context of the error and for the life time of the svn_error_t object. To learn how to use the Subversion APIs more, please see "Using the APIs"[1] section in the Subversion book and/or the section "APR pool usage conventions"[2], "Exception handling"[3] in chapter "Coding and Commit Convensions" in the Subversion Community Guide. [1] https://svnbook.red-bean.com/nightly/en/svn.developer.usingapi.html [2] https://subversion.apache.org/docs/community-guide/conventions.html#apr-pools [3] https://subversion.apache.org/docs/community-guide/conventions.html#exception-handling Cheers, -- Yasuhito FUTATSUKI <futat...@yf.bsclub.org>