内存不足-C解释器错误-想法?
因此,在大多数load Generator上运行脚本时,我遇到了获取C解释器错误的问题—内存冲突。我们有一对Server2003(8GBRAM)负载生成器,脚本可以在其上正常运行。但是,所有windows 7计算机(4gb ram)都不会运行该脚本。我的第一个倾向是它的内存不足,但是当我观察2003服务器上的资源时,当它运行时,当我运行脚本时,它只增加了200mb的内存 脚本的作用:它将文件读入内存,然后将缓冲区分配给LR参数,然后将该参数分配给MTOM SOAP请求的附件。当使用20mb及以下的小文件时,我可以在VUgen中运行它,较大的文件(如85mb)会导致内存访问冲突。然后我必须通过performance center运行它,使用2003 Server Load Generator,它可以正常运行和执行 由于它在内存较多的机器上运行,我本以为这更多是因为内存可用,但当脚本运行时,在2003服务器LG上使用的并不多 任何关于这方面的见解都将是伟大的 代码:内存不足-C解释器错误-想法?,c,memory-management,memory-leaks,out-of-memory,loadrunner,C,Memory Management,Memory Leaks,Out Of Memory,Loadrunner,因此,在大多数load Generator上运行脚本时,我遇到了获取C解释器错误的问题—内存冲突。我们有一对Server2003(8GBRAM)负载生成器,脚本可以在其上正常运行。但是,所有windows 7计算机(4gb ram)都不会运行该脚本。我的第一个倾向是它的内存不足,但是当我观察2003服务器上的资源时,当它运行时,当我运行脚本时,它只增加了200mb的内存 脚本的作用:它将文件读入内存,然后将缓冲区分配给LR参数,然后将该参数分配给MTOM SOAP请求的附件。当使用20mb及以下
有多少虚拟用户正在从磁盘读取数据,然后将其读入RAM中的缓冲区?85MB乘以多少?嘿,詹姆斯。我们每个LG运行一个虚拟用户。一个VU读取一个文件,因此将其设置为唯一参数,这样就不会发生冲突。您知道,如果没有指定类型,函数默认返回
int
?应该真正指定void
.Bump。。。通知:正在保存参数“pNewFileSize=87338479”。文件长度为:87338479字节。成功从文件中读取87338477字节:错误:无法分配大小为349353908的内存以将消息发送到日志文件FYI添加这两个字节的原因是我们正在将文件从windows计算机传输到linux计算机。Windows读取的文件大小较小,因为它不读取CTLF,因为Linux对此进行了计算。有多少虚拟用户正在从磁盘读取该文件,然后将其读入RAM中的缓冲区?85MB乘以多少?嘿,詹姆斯。我们每个LG运行一个虚拟用户。一个VU读取一个文件,因此将其设置为唯一参数,这样就不会发生冲突。您知道,如果没有指定类型,函数默认返回int
?应该真正指定void
.Bump。。。通知:正在保存参数“pNewFileSize=87338479”。文件长度为:87338479字节。成功从文件中读取87338477字节:错误:无法分配大小为349353908的内存以将消息发送到日志文件FYI添加这两个字节的原因是我们正在将文件从windows计算机传输到linux计算机。Windows读取的文件大小较小,因为它不读取CTLF,因为Linux对此进行了计算。
#define SEEK_SET 0 /* beginning of file. */
#define SEEK_CUR 1 /* current position. */
#define SEEK_END 2 /* end of file */
int requestPrepared = 0;
char *filename2 = "test.gz";
setEXTERNALfile()
{
long infile; // file pointer
char *buffer; // buffer to read file contents into
//Old Code
//char *filename = "C:\\EPD\\INDIVIDUAL\\XML\\EPDIndividual_1.xml"; // file to read. old code.
//Old code
char *filenumber[15];
int fileLen; // file size
int newfileLen; // New file size
int fileSizeSub; //linix file si
int bytesRead; // bytes read from file
char newfilename[40]; //contains file name path
char *fileext = ".xml"; // ext of file to read
typedef void *gzFile;
gzFile file;
int count;
//char *filenumber2[40];
char filename[155];
char fileDirectory[155];
sprintf(fileDirectory, "%s", lr_eval_string("{pFileDirectory}"));
lr_output_message("Current fileDirectory %s", lr_eval_string("{pFileDirectory}"));
sprintf(filename, "%s", lr_eval_string("{pFileName}"));
// 80 MB file
sprintf(newfilename,"\\\\LOCATION\\%s\\%s%s", fileDirectory, filename, fileext);
// open the file
infile = fopen(newfilename, "rb");
if (!infile) {
lr_error_message("Unable to open file %s", newfilename);
return;
}
// get the file length
fseek(infile, 0, SEEK_END);
fileLen=ftell(infile);
newfileLen=ftell(infile)+2;
fseek(infile, 0, SEEK_SET);
lr_log_message("File length is: %9d bytes.", fileLen);
lr_save_int(newfileLen,"pNewFileSize");
lr_log_message("New File length is: %9d bytes.", newfileLen);
// Allocate memory for buffer to read file
buffer=(char *)malloc(fileLen+1);
if (!buffer) {
lr_error_message("Could not malloc %10d bytes", fileLen+1);
fclose(infile);
return;
}
// Read file contents into buffer
bytesRead = fread(buffer, 1, fileLen, infile);
if (bytesRead != fileLen)
{
lr_error_message("File length is %10d bytes but only read %10d bytes", fileLen, bytesRead);
}
else
{
lr_log_message("Successfully read %9d bytes from file: ", bytesRead);
}
fclose(infile);
// Save the buffer to a loadrunner parameter
lr_save_var( buffer, bytesRead, 0, "fileDataParameter");
free(buffer);
//lr_log_message("File contents: %s", lr_eval_string("{fileDataParameter}"));