PDA

View Full Version : Bad allocation error


teognost
07-22-2008, 06:43 AM
Hi
I have got this error:

"Error firing vbld_StepDone event: Error in Step (VBScript) script code at Line 17, Column 1 (bad allocation)"

where the code referred in vbld_StepDone event is:
strLastStepOutput=Application.ExpandMacros("%LASTSTEP_OUTPUT%")

I checked and Application.Options.MaxStepOutputLength = 0
I checked and the output of last step is quite big,can this be the cause?
Any idea how to solve this issue?

kinook
07-22-2008, 07:25 AM
Originally posted by teognost
Hi
I have got this error:

"Error firing vbld_StepDone event: Error in Step (VBScript) script code at Line 17, Column 1 (bad allocation)"

where the code referred in vbld_StepDone event is:
strLastStepOutput=Application.ExpandMacros("%LASTSTEP_OUTPUT%")

I checked and Application.Options.MaxStepOutputLength = 0
I checked and the output of last step is quite big,can this be the cause?Possibly. How long is the output?

Any idea how to solve this issue? Not sure, but you may need to set a limit on the output length. Please ZIP and send to support@kinook.com:
1) The info from Help | About | Install Info
2) A screen shot of System properties (Windows+Break)
3) A .bld file that we can build here which demonstrates the problem

Thanks.

teognost
07-22-2008, 07:58 AM
I have sent an email with everything you requested.

Output is 12051 lines long.
Setting a limit to output length is not a good idea ,as I need to produce a report file containing differences between 2 files.
I use fc.exe in order to compare them:
fc.exe /LB1000 "C:\test\08.2.11.7\File.dis" "C:\test\08.2.11.12\File.dis"
In vbld_StepDone I create the diff file based on last step output:

Sub vbld_StepDone()

Dim strLastStepOutput
Wscript.Echo "******************************"
strLastStepOutput=Application.ExpandMacros("%LASTSTEP_OUTPUT%")
Wscript.Echo "******************************"
Dim strCurrDiffFileFullPath
strCurrDiffFileFullPath=Application.ExpandMacros("%CURRENT_DIFF_FILE_FULLPATH%")
Wscript.Echo "Current difference file is:"&strCurrDiffFileFullPath

Const ForReading = 1
Const ForWriting = 2
Const ForAppend = 8
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oFile = oFSO.OpenTextFile(strCurrDiffFileFullPath,forWriti ng,True)
oFile.Write strLastStepOutput
oFile.Close

End Sub

Is there any other way to create diff file without using
%LASTSTEP_OUTPUT%?

kinook
07-22-2008, 08:07 AM
Redirect the diff step's output to a file:

%DOSCMD% fc.exe /LB1000 "file1" "file2">%CURRENT_DIFF_FILE_FULLPATH%

and read program output from that file if also needed in the build log.

teognost
07-22-2008, 09:37 AM
ok,I changed this way,it works now,tks!
However pls let me know if you found a solution for the situation when using LASTSTEP_OUTPUT in order to avoid that bad allocation error appearing in case of big outputs
I tried to limit the output to 100000 and there was no error so I guess the size of output caused the issues with bad allocation err.

kinook
07-22-2008, 11:22 AM
Testing on a box with 2GB RAM, the build eventually completes without any errors. You may need more memory and/or a Windows Scripting update. But redirecting the program output directly to a file is much faster.