Exception of type 'System.OutOfMemoryException' was thrown.

muchink

Client
Регистрация
28.07.2012
Сообщения
193
Благодарностей
6
Баллы
18
Hi!
I have a template that merges a list of about 1000 lines of urls into a single variable(Variable1),
then the template takes another variable(Variable2) that contains many places that are supposed to be replaced with variable1.

e.g:

List 1 =
http://google.com
http://yahoo.com
http://bing.com
http://mozilla.com
http://CNN.com
(this file is about 100KB )

into variable 1:
"http://google.com;http://yahoo.com;http://bing.com;http://mozilla.com;http://CNN.com"


Variable 2 =

"hello my name is ZZZ and I know to play ZZZ" (this file is about 1MB )


then the process replaces ZZZ with Variable 1.


Yet, it seems that the process takes too much memory even though I have 4GB ram, and constant 2GB free..
Is there a way to make it work?


Thanks.

Edit:
I thought I solved it, instead of replacing all I just created a loop that replaces the first one every time till it gets to the end of the file.
But the same problem occurs after a few times that the program replaces the files, it probably creates a file bigger than 30mb. Is there a way to still do it ?
I have tried to add a pause of 3sec after each replacement to let the information flow before the next replacement occurs,yet it still didn't work.
 

muchink

Client
Регистрация
28.07.2012
Сообщения
193
Благодарностей
6
Баллы
18

Hungry Bulldozer

Moderator
Регистрация
12.01.2011
Сообщения
3 441
Благодарностей
834
Баллы
113
Could you please email your project to support email
 

muchink

Client
Регистрация
28.07.2012
Сообщения
193
Благодарностей
6
Баллы
18
Just sent it, hope to figure this out,
Thanks!
 

Hungry Bulldozer

Moderator
Регистрация
12.01.2011
Сообщения
3 441
Благодарностей
834
Баллы
113

Hungry Bulldozer

Moderator
Регистрация
12.01.2011
Сообщения
3 441
Благодарностей
834
Баллы
113
That's too big amount for 32 bit ProjectMaker. You should use C# for such big parts.

[xcode="csharp"]string rbPath = project.Variables["rbPath"].Value;
string linksPath = project.Variables["linksPath"].Value;
string readyFile = project.Variables["readyFile"].Value;
string rbText = System.IO.File.ReadAllText(rbPath);
string mergedList = string.Join("|",System.IO.File.ReadAllLines(linksPath));
mergedList = "{" + mergedList + "}";
string replacedText = rbText.Replace("XXXXXX", mergedList);
if (System.IO.File.Exists(readyFile))
System.IO.File.Delete(readyFile);
return Macros.TextProcessing.Spintax(replacedText);
[/code]
 

muchink

Client
Регистрация
28.07.2012
Сообщения
193
Благодарностей
6
Баллы
18
Got it, thanks!
 

Кто просматривает тему: (Всего: 1, Пользователи: 0, Гости: 1)