Hi,
I want to get the following errors in traceinfo. Somehow i haven’t
been able to simulate them .
I want one of the below lines to be logged in traceinfo.
00003024 internal heap exhaustion (nbytes=d/t) (object=s)
or
Jun 28 19:51:34 2 00003024 00013F1B 00052EEB 646F6E69 65
Jun 28 19:51:34 2 00003024 00013F1B 00052EEB 646F6E69 65
Jun 28 19:51:34 2 00003024 00013F1B 00052EEB 656D616E
Jun 28 19:51:34 2 00003024 00013F1B 00052EEB 656D616E
Jun 28 19:51:34 2 00003024 00013F1B 00052EEB 656D616E
Jun 28 19:51:34 2 00003024 00013F1B 00052EEB 656D616E
Jun 28 19:51:34 2 00003024 00013F1B 00052EEB 646F6E69 65
Jun 28 19:51:34 2 00003024 00013F1B 00052EEB 656D616E
Jun 28 19:51:39 2 00003024 00013F1B 00052EEB 646F6E69 65
Jun 28 19:51:39 2 00003024 00013F1B 00052EEB 656D616E
I know the fix for this but i want to simulate and know if the fix
works.
I have written some piece of code as below but none of them produces
3024 in traceinfo.
Code 1:
Regards
Navin
bash-2.00$ ./a.out
Opening file:0
Opening file:1
Opening file:2
Opening file:3
Opening file:4
Opening file:5
Opening file:6
Opening file:7
Opening file:8
Opening file:9
Opening file:10
Opening file:11
Opening file:12
Opening file:13
Opening file:14
Opening file:15
Opening file:16
Opening file:17
Opening file:18
Opening file:19
//1/home/spothuri/a.out terminated (SIGSEGV) at
10A3:000011BE.
Segmentation fault
bash-2.00$ cat f_ld1.c
#include<stdio.h>
#include<fcntl.h>
#include<sys/stat.h>
#include<unistd.h>
#include<sys/types.h>
#define MAX 100
FILE *fp[MAX];
int arr[MAX];
char str[20] = “/tmp/large/”, stra[6],
buf[20] = “large disk try”;
int
main ()
{
int i,j;
for (i = 0; i < MAX; i++)
{
printf (“Opening file:%d\n”, i);
sprintf (stra, “%d”, i);
strcat (str, stra);
arr _= open (str, O_CREAT | O_WRONLY|O_EXCL);
write (arr, buf, sizeof (buf));
/* With and without below 2 lines i get the same error /
for(j=0;j<10;j++)
arr[MAX-i-1]=dup(arr);
/ close (arr); */
}
return 0;
}
bash-2.00$
\
[code:1:d97ce39369]
bash-2.00$ cat fork.c
int main()
{
while(1)
{
fork();
}
return 0;
}
bash-2.00$ traceinfo | tail
Jul 10 08:42:53 2 00001014 No free pid
Jul 10 08:42:53 2 00001014 No free pid
Jul 10 08:42:53 2 00001014 No free pid
Jul 10 08:42:53 2 00001014 No free pid
Jul 10 08:42:53 2 00001014 No free pid
Jul 10 08:42:53 2 00001014 No free pid
Jul 10 08:42:53 2 00001014 No free pid
Jul 10 08:42:53 2 00001014 No free pid
Jul 10 08:42:53 2 00001014 No free pid
Warning! 49935 overruns have occurred. Some trace events lost.
bash-2.00$
[/code:1:d97ce39369]_