Menu

#3 OutOfMemory exception

open
nobody
None
5
2009-08-16
2009-08-16
No

Hi,

first of all, I want to say that this is a very useful tool and exactly what I was looking for. Sadly, we got an OutOfMemory exeption only a few hours after going life with this hook (about 30 commits).

Here's the stack trace as shown in the log file:
at System.String.GetStringForStringBuilder(String value, Int32 startIndex, Int32 length, Int32 capacity)
at System.Text.StringBuilder.GetNewString(String currentString, Int32 requiredLength)
at System.Text.StringBuilder.Append(String value)
at SubversionNotify.HTMLProcessor.DiffFilesHTML(String unifiedDiff)
at SubversionNotify.HTMLProcessor.DiffFilesHTML()
at SubversionNotify.HTMLProcessor.ProcessMessage(List`1 trackedItems)
at SubversionNotify.Program.PostCommitProcessing(HTMLProcessor proc, subversionNotifyConfig cfg, String logFileName, String baseFolder)
at SubversionNotify.Program..ctor(String repository, String revision, ProcessType prePost)
at SubversionNotify.Program.Main(String[] args)

Getting an OutOfMemory exception in a managed language seems strange, but luckily we ran into this problem ourselves a couple of months ago so I had some clue what could trigger the problem. As suspected you too use RegEx several times.
As stated in this blog (http://blogs.msdn.com/ravi_kumar/archive/2008/03/22/out-of-memory-issues-to-watch-out-for-when-using-regular-expressions.aspx) RegEx can cause OutOfMemory exceptions, so my guess is, this exception is caused by RegEx.

I've tried to apply the suggestion according to the mentioned blog and set the regex instances to null as soon as they are not needed anymore (see attached patch files). Sadly, I still get OutOfMemory exceptions, but not on a daily basis (we use it since august 7th and till now encountered 3 OutOfMemory exceptions.

I should also mention that we're only using the postcommit hook.

Discussion

  • Markus Hastreiter

    set regex to null after usage

     
  • Markus Hastreiter

    set regex to null after usage

     
  • Maline

    Maline - 2010-05-26

    Same thing happened to me, after a commit that include lots of new files. The program failed at the postcommit hook. The commit was properly dump, but I got this dump:

    [2010-05-25 17:39:36,690] INFO SubversionNotify.Program SetRepoPathPrecidence :: Incomming configs = 2 ; Returning configs = 2
    [2010-05-25 17:40:41,956] ERROR SubversionNotify.Program Error starting. Arguments Provided: C:/svn_repository 8083 -post
    System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
    at System.String.GetStringForStringBuilder(String value, Int32 startIndex, Int32 length, Int32 capacity)
    at System.Text.StringBuilder.GetNewString(String currentString, Int32 requiredLength)
    at System.Text.StringBuilder.Append(String value)
    at SubversionNotify.HTMLProcessor.DiffFilesHTML(String unifiedDiff)
    at SubversionNotify.HTMLProcessor.DiffFilesHTML()
    at SubversionNotify.HTMLProcessor.ProcessMessage(List`1 trackedItems)
    at SubversionNotify.Program.PostCommitProcessing(HTMLProcessor proc, subversionNotifyConfig cfg, String baseFolder)
    at SubversionNotify.Program..ctor(String repository, String revision, ProcessType prePost)
    at SubversionNotify.Program.Main(String[] args)
    [2010-05-25 17:40:45,409] INFO SubversionNotify.Program
    Subversion Notify error.

    Keep on it, the project is very useful :)

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.