php.net |  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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: BenBE at omorphia dot de
New email:
PHP Version: OS:

 

 [2008-06-15 12:49 UTC] BenBE at omorphia dot de
Description:
------------
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 = "http://geshi.svn.sourceforge.net/svnroot/geshi/";
$file = $repo . "/file";

for($i = 0; $i < 100; $i++) {
    svn_log($repo);
    svn_ls($repo);
    svn_cat($file);
}

?>


Expected result:
----------------
No output

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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-06-16 06:22 UTC] scottmac@php.net
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 = "http://geshi.svn.sourceforge.net/svnroot/geshi";

$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";

        svn_ls($repo);
        echo number_format(memory_get_usage()) . "\n";

        svn_cat($file);
        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] scottmac@php.net
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 
usage.

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