標籤:http io os 使用 ar strong for div sp
問題描述,在Action.c裡定義數組時如果數組長度過長,如char a[1024*1024]運行時即會報錯:
問題原因及解決方案如下:
1. VuGen對於局部變數可以分配的最大記憶體為64K,如果想分配空間大於64K的變數的話,需要通過如下方法:
VuGen has a limitation of 64K for local variables. If you want to declare a variable larger than 64K:
a. 將其定義為全域變數,Declare it globally.
b. 使用malloc()來分配記憶體,Use malloc() to allocate the memory.
查看原始碼 列印協助
5 |
char *buffer = (char *) malloc(100000); |
7 |
/*Remember to free it when you do not need it*/ |
2. 如果在錄製指令碼後進行回放時報錯,可以按照下面步驟進行配置:
If you have this problem replaying a large database script in LoadRunner 7.8 or above, immediately after recording.
a. Go to Tools -> Regenerate Vusers...
b. Click on ‘Options...‘ to edit the recording options
c. Under General:
1. Script section, enable the option for "Split action section to functions by event".By default, this is not enabled and it has a value of "500". This option is useful for when the action section is rather large
2. Script and select "Maximum number of lines in action file", change the value to 30000 and regenerate again
轉:Loadrunner報錯“Too many local variablesAction.c”解決方案