10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
* Copyright (c) 1998-1999 by Scriptics Corporation.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
* This code contributed by Karl Lehenbauer and Mark Diekhans
*
* RCS: @(#) $Id: tclCkalloc.c,v 1.38.4.1 2010/10/02 01:38:27 kennykb Exp $
*/
#include "tclInt.h"
#define FALSE 0
#define TRUE 1
|
|
|
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
* Copyright (c) 1998-1999 by Scriptics Corporation.
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
* This code contributed by Karl Lehenbauer and Mark Diekhans
*
* RCS: @(#) $Id: tclCkalloc.c,v 1.38.4.2 2010/12/01 16:42:34 kennykb Exp $
*/
#include "tclInt.h"
#define FALSE 0
#define TRUE 1
|
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
|
fprintf(stderr,"ckalloc %lx %u %s %d\n",
(long unsigned int) result->body, size, file, line);
}
if (break_on_malloc && (total_mallocs >= break_on_malloc)) {
break_on_malloc = 0;
(void) fflush(stdout);
fprintf(stderr,"reached malloc break limit (%d)\n",
total_mallocs);
fprintf(stderr, "program will now enter C debugger\n");
(void) fflush(stderr);
abort();
}
current_malloc_packets++;
if (current_malloc_packets > maximum_malloc_packets) {
maximum_malloc_packets = current_malloc_packets;
}
current_bytes_malloced += size;
|
|
<
<
<
<
|
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
|
fprintf(stderr,"ckalloc %lx %u %s %d\n",
(long unsigned int) result->body, size, file, line);
}
if (break_on_malloc && (total_mallocs >= break_on_malloc)) {
break_on_malloc = 0;
(void) fflush(stdout);
Tcl_Panic("reached malloc break limit (%d)", total_mallocs);
}
current_malloc_packets++;
if (current_malloc_packets > maximum_malloc_packets) {
maximum_malloc_packets = current_malloc_packets;
}
current_bytes_malloced += size;
|
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
|
fprintf(stderr,"ckalloc %lx %u %s %d\n",
(long unsigned int) result->body, size, file, line);
}
if (break_on_malloc && (total_mallocs >= break_on_malloc)) {
break_on_malloc = 0;
(void) fflush(stdout);
fprintf(stderr,"reached malloc break limit (%d)\n",
total_mallocs);
fprintf(stderr, "program will now enter C debugger\n");
(void) fflush(stderr);
abort();
}
current_malloc_packets++;
if (current_malloc_packets > maximum_malloc_packets) {
maximum_malloc_packets = current_malloc_packets;
}
current_bytes_malloced += size;
|
|
<
<
<
<
|
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
|
fprintf(stderr,"ckalloc %lx %u %s %d\n",
(long unsigned int) result->body, size, file, line);
}
if (break_on_malloc && (total_mallocs >= break_on_malloc)) {
break_on_malloc = 0;
(void) fflush(stdout);
Tcl_Panic("reached malloc break limit (%d)", total_mallocs);
}
current_malloc_packets++;
if (current_malloc_packets > maximum_malloc_packets) {
maximum_malloc_packets = current_malloc_packets;
}
current_bytes_malloced += size;
|
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
|
goto bad_suboption;
}
validate_memory = (strcmp(argv[2],"on") == 0);
return TCL_OK;
}
Tcl_AppendResult(interp, "bad option \"", argv[1],
"\": should be active, break_on_malloc, info, init, onexit, "
"tag, trace, trace_on_at_malloc, or validate", NULL);
return TCL_ERROR;
argError:
Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
" ", argv[1], " count\"", NULL);
return TCL_ERROR;
|
|
|
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
|
goto bad_suboption;
}
validate_memory = (strcmp(argv[2],"on") == 0);
return TCL_OK;
}
Tcl_AppendResult(interp, "bad option \"", argv[1],
"\": should be active, break_on_malloc, info, init, objs, onexit, "
"tag, trace, trace_on_at_malloc, or validate", NULL);
return TCL_ERROR;
argError:
Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],
" ", argv[1], " count\"", NULL);
return TCL_ERROR;
|
1311
1312
1313
1314
1315
1316
1317
1318
1319
|
}
/*
* Local Variables:
* mode: c
* c-basic-offset: 4
* fill-column: 78
* End:
*/
|
>
>
|
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
|
}
/*
* Local Variables:
* mode: c
* c-basic-offset: 4
* fill-column: 78
* tab-width: 8
* indent-tabs-mode: nil
* End:
*/
|