- register int i, j;
- register union overhead *p;
- int totfree = 0,
- totused = 0;
-
- if (s[1])
- printf("Memory allocation statistics %s\nfree:", s[1]);
- for (i = 0; i < NBUCKETS; i++) {
- for (j = 0, p = nextf[i]; p; p = p->ov_next, j++)
- ;
-
- if (s[1])
- printf(" %d", j);
- totfree += j * (1 << (i + 3));
- }
- if (s[1])
- printf("\nused:");
- for (i = 0; i < NBUCKETS; i++) {
- if (s[1])
- printf(" %d", nmalloc[i]);
- totused += nmalloc[i] * (1 << (i + 3));
- }
- if (s[1])
- printf("\n");
- printf("Total in use: %d, total free: %d\n", totused, totfree);
+#ifndef SYSMALLOC
+ register int i, j;
+ register union overhead *p;
+ int totfree = 0, totused = 0;
+
+ (void) fprintf(cshout, "csh current memory allocation:\nfree:\t");
+ for (i = 0; i < NBUCKETS; i++) {
+ for (j = 0, p = nextf[i]; p; p = p->ov_next, j++);
+ (void) fprintf(cshout, " %4d", j);
+ totfree += j * (1 << (i + 3));
+ }
+ (void) fprintf(cshout, "\nused:\t");
+ for (i = 0; i < NBUCKETS; i++) {
+ (void) fprintf(cshout, "%4d", nmalloc[i]);
+ totused += nmalloc[i] * (1 << (i + 3));
+ }
+ (void) fprintf(cshout, "\n\tTotal in use: %d, total free: %d\n",
+ totused, totfree);
+ (void) fprintf(cshout,
+ "\tAllocated memory from 0x%lx to 0x%lx. Real top at 0x%lx\n",
+ membot, memtop, (char *) sbrk(0));
+#else
+ (void) fprintf(cshout, "Allocated memory from 0x%lx to 0x%lx (%ld).\n",
+ membot, memtop = (char *) sbrk(0), memtop - membot);
+#endif /* SYSMALLOC */