1 /* $Header: /cvsroot/lesstif/lesstif/test/Xm/cascadebuttong/test3.c,v 1.6 2001/05/23 15:00:02 amai Exp $
2 From: Yasushi Yamasaki <yamapu@osk3.3web.ne.jp>
3 To: lesstif@hungry.com
4 Subject: bug report
5 Date: Sun, 30 Aug 1998 23:55:47 +0900
6 Cc: yamapu@osk3.3web.ne.jp
7 */
8
9 #include <stdlib.h>
10 #include <stdio.h>
11 #include <unistd.h>
12
13 #include <Xm/Xm.h>
14 #include <Xm/RowColumn.h>
15 #include <Xm/CascadeBG.h>
16
17 int
main(int argc,char * argv[])18 main(int argc, char *argv[])
19 {
20 XtAppContext app;
21 Widget shell, w, rc;
22 void *before;
23 void *after;
24 int iter = 0;
25 int diff = 0;
26 int total = 0;
27
28 shell = XtAppInitialize(&app, "Test", NULL, 0,
29 &argc, argv, NULL, NULL, 0);
30 rc = XmCreateMenuBar(shell, "RC", NULL, 0);
31 while (iter < 10000)
32 {
33 before = sbrk((ptrdiff_t) 0);
34 w = XtCreateWidget("name", xmCascadeButtonGadgetClass, rc, NULL, 0);
35 XtDestroyWidget(w);
36 after = sbrk((ptrdiff_t) 0);
37 if ((int)((char *)after - (char *)before) > 0)
38 {
39 if (iter != 0)
40 {
41 /* printf("%i %i %p %i\n", iter, iter - diff, after -
42 before, (after - before) / (iter - diff)); */
43 total += (int)((char *)after - (char *)before);
44 }
45 diff = iter;
46 }
47 iter++;
48 }
49 printf("leaking %i bytes per Create/Destroy\n", total / iter);
50 exit((int)(total / iter));
51 }
52