You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Ben Collins <bc...@debian.org> on 2002/03/07 21:23:33 UTC

[patch] Kill some memory eaters

Here's a few memory leakers I found while searching through apr pool
debug output for a commit. Testsuite runs to completiong with no
problems, with this patch. This includes the patch to svn_wc_entry to
use a subpool, except for the allocation of the entry returned.


  * libsvn_fs/tree.c:

    (open_path): If svn_fs__dag_open returns an SVN_ERR_FS_NOT_FOUND
      error, we don't use the error return, so svn_error_free it.

  * libsvn_wc/entries.c:

    Based on a patch from Kevin Pilch-Bisson.

    (svn_wc_entry): Use a subpool for all allocations and destroy it.
      When we find the entry we want, use svn_wc__entry_dup() to
      allocate it in our primary pool.

    (svn_wc__entry_dup): Check for a NULL entry to dup, and return NULL
      in this case.

  * libsvn_wc/adm_ops.c:

    (process_committed): We don't use the error returned by
      svn_wc__open_adm_file, so svn_error_free it.

  * libsvn_wc/adm_files.c:

    (check_adm_exists): In the case where we don't use the error from
      svn_wc__open_adm_file, svn_error_free the return.

  * libsvn_wc/update_editor.c:

    (apply_textdelta): In the case where we don't use the error from
      svn_wc__open_text_base, svn_error_free the return.

    (svn_wc_is_wc_root): Since we don't use the error return from
      svn_wc_entry, svn_error_free it.

  * libsvn_wc/questions.c:

    (svn_wc_check_wc): Since we don't use the error return from
      svn_wc__open_adm_file, svn_error_free it.

  * libsvn_client/commit.c:

    (send_to_repos): Create and use a subpool for everything except the
      creation of commit_info (which gets returned higher up to the
      caller) via svn_client__make_commit_info. Destroy the subpool.

    (svn_client_commit): Create and use a subpool for everything except
      the call to send_to_repos, which fills in our commit_info struct
      to pass back to our caller. Now, we are truely clean.


-- 
 .----------=======-=-======-=========-----------=====------------=-=-----.
/       Ben Collins    --    Debian GNU/Linux    --    WatchGuard.com      \
`          bcollins@debian.org   --   Ben.Collins@watchguard.com           '
 `---=========------=======-------------=-=-----=-===-======-------=--=---'

Re: [patch] Kill some memory eaters

Posted by Karl Fogel <kf...@newton.ch.collab.net>.
Ben Collins <bc...@debian.org> writes:
> Here's a few memory leakers I found while searching through apr pool
> debug output for a commit. Testsuite runs to completiong with no
> problems, with this patch. This includes the patch to svn_wc_entry to
> use a subpool, except for the allocation of the entry returned.

Thanks, Ben (and Kevin)!  

I've effectively applied the portions of this patch that added calls
to svn_error_free(), see revision 1460 for details.  This patch was
definitely the inspiration for that.

The rest of the patch is about adding subpools in a few spots, and I
want to sleep on that and discuss w/ Mike, Greg, et al in the morning,
as we generally aim for iteration-based pool control, not depth-based,
except where the benefit is very clear (the svn_wc_entry subpool seems
a strong candidate here, must admit).  But anyway, the subpool stuff
seems a conceptually separate change, so didn't commit it with the
pool clear change.

-Karl

>   * libsvn_fs/tree.c:
> 
>     (open_path): If svn_fs__dag_open returns an SVN_ERR_FS_NOT_FOUND
>       error, we don't use the error return, so svn_error_free it.
> 
>   * libsvn_wc/entries.c:
> 
>     Based on a patch from Kevin Pilch-Bisson.
> 
>     (svn_wc_entry): Use a subpool for all allocations and destroy it.
>       When we find the entry we want, use svn_wc__entry_dup() to
>       allocate it in our primary pool.
> 
>     (svn_wc__entry_dup): Check for a NULL entry to dup, and return NULL
>       in this case.
> 
>   * libsvn_wc/adm_ops.c:
> 
>     (process_committed): We don't use the error returned by
>       svn_wc__open_adm_file, so svn_error_free it.
> 
>   * libsvn_wc/adm_files.c:
> 
>     (check_adm_exists): In the case where we don't use the error from
>       svn_wc__open_adm_file, svn_error_free the return.
> 
>   * libsvn_wc/update_editor.c:
> 
>     (apply_textdelta): In the case where we don't use the error from
>       svn_wc__open_text_base, svn_error_free the return.
> 
>     (svn_wc_is_wc_root): Since we don't use the error return from
>       svn_wc_entry, svn_error_free it.
> 
>   * libsvn_wc/questions.c:
> 
>     (svn_wc_check_wc): Since we don't use the error return from
>       svn_wc__open_adm_file, svn_error_free it.
> 
>   * libsvn_client/commit.c:
> 
>     (send_to_repos): Create and use a subpool for everything except the
>       creation of commit_info (which gets returned higher up to the
>       caller) via svn_client__make_commit_info. Destroy the subpool.
> 
>     (svn_client_commit): Create and use a subpool for everything except
>       the call to send_to_repos, which fills in our commit_info struct
>       to pass back to our caller. Now, we are truely clean.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org