Remove code to calculate memory usage with sbrk().
In many systems, malloc() can allocate outside the brk area. The calculation with sbrk() misses those allocations. When LLgen or ncgg reported the memory usage, the value was probably too low.
This commit is contained in:
parent
1c8434e33a
commit
33c0573598
|
@ -37,12 +37,10 @@ extern fatal();
|
||||||
extern comfatal();
|
extern comfatal();
|
||||||
extern copyfile();
|
extern copyfile();
|
||||||
extern void install();
|
extern void install();
|
||||||
extern char *sbrk();
|
|
||||||
|
|
||||||
main(argc,argv) register string argv[]; {
|
main(argc,argv) register string argv[]; {
|
||||||
register string arg;
|
register string arg;
|
||||||
string libpath();
|
string libpath();
|
||||||
char *beg_sbrk = 0;
|
|
||||||
|
|
||||||
/* Initialize */
|
/* Initialize */
|
||||||
|
|
||||||
|
@ -129,8 +127,6 @@ main(argc,argv) register string argv[]; {
|
||||||
argc--;
|
argc--;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (verbose) beg_sbrk = sbrk(0);
|
|
||||||
|
|
||||||
#ifdef NON_CORRECTING
|
#ifdef NON_CORRECTING
|
||||||
if ((subpars_sim) && (!non_corr)) {
|
if ((subpars_sim) && (!non_corr)) {
|
||||||
fprintf(stderr,"option -s illegal without -n, turned off\n");
|
fprintf(stderr,"option -s illegal without -n, turned off\n");
|
||||||
|
@ -206,7 +202,6 @@ main(argc,argv) register string argv[]; {
|
||||||
fprintf(stderr, "number of tokens: %d\n", ntokens);
|
fprintf(stderr, "number of tokens: %d\n", ntokens);
|
||||||
fprintf(stderr, "number of term structures: %d\n", nterms);
|
fprintf(stderr, "number of term structures: %d\n", nterms);
|
||||||
fprintf(stderr, "number of alternation structures: %d\n", nalts);
|
fprintf(stderr, "number of alternation structures: %d\n", nalts);
|
||||||
fprintf(stderr, "total memory used: %ld\n", (long)(sbrk(0) - beg_sbrk));
|
|
||||||
}
|
}
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,8 +11,6 @@ static char rcsid[]= "$Id$";
|
||||||
#include "extern.h"
|
#include "extern.h"
|
||||||
|
|
||||||
char *filename;
|
char *filename;
|
||||||
char *beg_sbrk;
|
|
||||||
extern char *sbrk();
|
|
||||||
|
|
||||||
main(argc,argv) char **argv; {
|
main(argc,argv) char **argv; {
|
||||||
extern int nerrors;
|
extern int nerrors;
|
||||||
|
@ -20,8 +18,6 @@ main(argc,argv) char **argv; {
|
||||||
extern int tabledebug;
|
extern int tabledebug;
|
||||||
extern int verbose;
|
extern int verbose;
|
||||||
|
|
||||||
beg_sbrk = sbrk(0);
|
|
||||||
|
|
||||||
while (argc >1 && argv[1][0]=='-') {
|
while (argc >1 && argv[1][0]=='-') {
|
||||||
switch(argv[1][1]) {
|
switch(argv[1][1]) {
|
||||||
case 'c':
|
case 'c':
|
||||||
|
|
|
@ -902,7 +902,6 @@ used(resource,use,max) char *resource; {
|
||||||
}
|
}
|
||||||
|
|
||||||
statistics() {
|
statistics() {
|
||||||
extern char *beg_sbrk,*sbrk();
|
|
||||||
extern int nnodes, maxempatlen,maxrule;
|
extern int nnodes, maxempatlen,maxrule;
|
||||||
|
|
||||||
used("Registers",nregs,MAXREGS);
|
used("Registers",nregs,MAXREGS);
|
||||||
|
@ -926,5 +925,4 @@ statistics() {
|
||||||
used("Pat bytes",npatbytes+1,MAXPATBYTES);
|
used("Pat bytes",npatbytes+1,MAXPATBYTES);
|
||||||
if (tabledebug)
|
if (tabledebug)
|
||||||
used("Source lines",maxline,MAXSOURCELINES);
|
used("Source lines",maxline,MAXSOURCELINES);
|
||||||
fprintf(stderr,"%ldK heap used\n",((long) (sbrk(0)-beg_sbrk+1023))/1024);
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue