Replace all causing system out of memory exceptions

Ask general questions here.
User avatar
Gunner1980
Posts: 89
Joined: Mon Apr 05, 2010 8:44 pm
Location: Austin, Texas

Replace all causing system out of memory exceptions

Post by Gunner1980 » Wed May 19, 2010 4:00 pm

So I am trying to search my whole solution or even a project and replace one particular word with another. I am noticing that Ranorex opens every single file that has this word in it prior to saving it. This seems like a really bad way to do things as the more files you open the more memory seems to be used. After I let the replace all feature run for about 5 to 10 minutes I start getting exceptions thrown left and right saying I am out of memory.

My question is why is Ranorex opening every single file it finds that text in and is there any way to turn it off. I know Visual Studio has an option like this but I can't find it in Ranorex. I am guessing it is opening the files so you have a way to undo your changes. The other issue with this is nothing is saved after you do a replace all, instead you have to choose to save all open buffers. This too is sometimes causing an out of memory exception. Even after saving the items it does find prior to the exception nothing really gets saved. After I close Ranorex and reopen it none of the replacements were saved, I am guessing Ranorex just sort of shuts down after this exception and needs to be restarted.

I have noticed this functionality where Ranorex is opening all the files associated with a change in other areas of Ranorex as well and it is very annoying.

In case you were wondering why I was using this replace all feature it is because an object we use in almost all of our recordings name changed (which is how we are identifying it by accessiblename). I had tried changing the item in the repository but while it was rewriting all the files associated with that repository item I once again got an out of memory exception.

This is something that I can forsee happening often since it is the nature of software to change, I need to be able to easily update my recordings and change repository item names without getting these errors. I am using v2.3 by the way.

Please help!

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Replace all causing system out of memory exceptions

Post by Support Team » Thu May 20, 2010 3:42 pm

Hi,
Gunner1980 wrote:My question is why is Ranorex opening every single file it finds that text in and is there any way to turn it off. I know Visual Studio has an option like this but I can't find it in Ranorex. I am guessing it is opening the files so you have a way to undo your changes.
Your guess is completely correct about why Ranorex is opening every single file. About the option of Visual Studio, I know it, but Ranorex is based on the Sharp Develop Studio and there is no such feature implemented yet. I've added it to our internal feature request list.
Gunner1980 wrote:Even after saving the items it does find prior to the exception nothing really gets saved.
We know about this bug and we already fixed it. This occurs if you have about more than hundred changes in your project and you didn't save your project from time to time. This unsaved hundred changes lead to the exception you got. The bug fix will be released in the next service release.

Can you told me how much replaces you've done?
I tried it and I got no exception (about 50 000 replaces in my project)

Regards,
Peter
Ranorex Support Team

User avatar
Gunner1980
Posts: 89
Joined: Mon Apr 05, 2010 8:44 pm
Location: Austin, Texas

Re: Replace all causing system out of memory exceptions

Post by Gunner1980 » Thu May 20, 2010 4:38 pm

I did a find all and the item I am trying to do a replace all on has 4179 occurrences in 246 files

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Replace all causing system out of memory exceptions

Post by Support Team » Thu May 20, 2010 5:04 pm

Hi,

Please can you post me some more informations:
  • How big is your RAM?
  • How big is your page file?
  • Can you post the complete exception message?
Gunner1980 wrote:I did a find all and the item I am trying to do a replace all on has 4179 occurrences in 246 files
50000 occurrences in 228 files and I got no exception.

Thanks

Regards,
Peter
Ranorex Support Team

User avatar
Gunner1980
Posts: 89
Joined: Mon Apr 05, 2010 8:44 pm
Location: Austin, Texas

Re: Replace all causing system out of memory exceptions

Post by Gunner1980 » Fri May 21, 2010 6:43 am

Windows XP
CPU Pentium 4 2.8 GHZ
2 GB RAM
paging file size = 1536 MB

Below is the full exception

Code: Select all

Ranorex Studio Version : 2.3.0.8345
.NET Version         : 2.0.50727.3053
OS Version           : Microsoft Windows NT 5.1.2600 Service Pack 3
Current culture      : English (United States) (en-US)
Terminal Server Session
Working Set Memory   : 1222440kb
GC Heap Memory       : 1187609kb

Exception thrown:
System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
   at System.String.GetStringForStringBuilder(String value, Int32 startIndex, Int32 length, Int32 capacity)
   at System.Convert.ToBase64String(Byte[] inArray, Int32 offset, Int32 length, Base64FormattingOptions options)
   at System.Convert.ToBase64String(Byte[] inArray, Base64FormattingOptions options)
   at Ranorex.Core.ValueConverter.ToString(Object value)
   at Ranorex.Core.Repository.RepositoryEntry.GetXmlNode(XmlNode parent)
   at Ranorex.Core.Repository.RepositoryItem.GetXmlNode(XmlNode parent)
   at Ranorex.Core.Repository.RepositoryFolder.GetXmlNode(XmlNode parent)
   at Ranorex.Core.Repository.RootedRepositoryFolder.GetXmlNode(XmlNode parent)
   at Ranorex.Core.Repository.RepositoryAppFolder.GetXmlNode(XmlNode parent)
   at Ranorex.Core.Repository.RepositoryFolder.GetXmlNode(XmlNode parent)
   at Ranorex.Core.Repository.RootedRepositoryFolder.GetXmlNode(XmlNode parent)
   at Ranorex.Core.Repository.RepositoryAppFolder.GetXmlNode(XmlNode parent)
   at Ranorex.Core.Repository.ElementRepository.ToXmlNode()
   at Ranorex.Core.Recorder.RecordTable.ToXmlString()
   at Ranorex.Core.Recorder.RecordTable.get_IsDirty()
   at Ranorex.Addins.RecorderPrimaryViewContent.<UpDateIsDirty>b__a()

---- Recent log messages:
Failed to append recent log messages.
System.InvalidOperationException: Sequence contains no elements
   at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source)
   at ICSharpCode.SharpDevelop.Sda.LogMessageRecorder.AppendRecentLogMessages(StringBuilder sb, ILog log)
   at ICSharpCode.SharpDevelop.Sda.ExceptionBox.getClipboardString()

---- Post-error application state information:
Installed 3rd party AddIns: [RanorexLogViewer 2.3.0.8345], [RxObjectRepository 2.3.0.8345], [RxRecorder 2.3.0.8345], [Workflow Foundation Designer 2.3.0.8345], [ElementTree 2.3.0.8345]
Workbench.ActiveContent: Ranorex.Addins.RecorderPrimaryViewContent
ProjectService.OpenSolution: [Solution: FileName=C:\Documents and Settings\gguenther\Desktop\UltraATSMaster\UltraATSMaster.rxsln, HasProjects=True, ReadOnly=False]
ProjectService.CurrentProject: [CSharpProject: TacViewLib]

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Replace all causing system out of memory exceptions

Post by Support Team » Fri May 21, 2010 10:52 am

Hi,

Thanks for posting the full exception. I think this should be resolved with the bug fix (I wrote above) in the next service release. We improved our memory management with this bug fix.

Regards,
Peter
Ranorex Support Team