|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #58234 Memory Leak with basic SVN functions
Submitted: 2008-06-15 12:49 UTC Modified: 2011-10-05 21:11 UTC
From: BenBE at omorphia dot de Assigned:
Status: No Feedback Package: svn (PECL)
PHP Version: 5.2.5 OS: Debian
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
Solve the problem:
10 + 5 = ?
Subscribe to this entry?

 [2008-06-15 12:49 UTC] BenBE at omorphia dot de
I'm using this extension on Apache 2.2.8-5 (prefork) with mod_php and PHP 5.2.6-1 (Debian Lenny / Unstable). After only few calls of a script basically invoking the following functions the memory is recognizably crouded:
- svn_log
- svn_ls
- svn_cat

Reproduce code:

$repo = "";
$file = $repo . "/file";

for($i = 0; $i < 100; $i++) {


Expected result:
No output

Actual result:
Fatal error: Out of memory (allocated ??? (tried to allocate ??? bytes) in /tmp/test.php on line ???


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2008-06-16 06:22 UTC]
I can't reproduce this, though I have to say svn_log on every path of the geshi respository isn't all that wise since its 22,196 entries and each of those array entries will have sub arrays for files changed.

This may not even be a leak but expected memory usage from such a large repository.

I'm using the following, limited to the last revision for svn_log.

$repo = "";

$file = $repo . "/file";

for($i = 0; $i < 100; $i++) {

        svn_log($repo, SVN_REVISION_HEAD, SVN_REVISION_INITIAL, 1);
        echo number_format(memory_get_usage()) . "\n";

        echo number_format(memory_get_usage()) . "\n";

        echo number_format(memory_get_usage()) . "\n\n";


After a few iterations it uses a consistent amount of memory.
 [2008-06-19 04:58 UTC] BenBE at omorphia dot de
I basically used svn_log and svn_ls to get information on a REPO "per version" without subdirs. I'll send you the full script I used at the weekend.

There is no real "loop" as in the example source, but repeated calling of the script (That's why my hint on Apache Prefork).
 [2008-06-30 20:26 UTC]
I finally had some time to check this out and I added a 
memory_get_usage(true) to the end of the script to get the 
peak memory allocated but I don't see any error or high memory 

Are you trying this with the svn 0.4.1 extension?
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Jun 22 12:01:30 2024 UTC