码迷,mamicode.com
首页 > 其他好文 > 详细

转:Loadrunner报错“Too many local variablesAction.c”解决方法

时间:2014-09-25 12:06:18      阅读:269      评论:0      收藏:0      [点我收藏+]

标签: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.

1 char buffer[100000];
2  
3 Actions()
4  
5 {
6  
7 return 0;
8  
9 }

b. 使用malloc()来分配内存,Use malloc() to allocate the memory.

1 Actions()
2  
3 {
4  
5 char *buffer = (char *) malloc(100000);
6  
7 /*Remember to free it when you do not need it*/
8  
9 free(buffer);
10  
11 return 0;
12  
13 }

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”解决方法

标签:http   io   os   使用   ar   strong   for   div   sp   

原文地址:http://www.cnblogs.com/lci05/p/3992225.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!