History

restore a max memory usage printing for a new MEM_DEBUG when -bench

seyko committed 11 years ago

Commit 1234bec1 parent c52e1a92 files · +7 −4Browse files

Unified · Split

2 files
  1. libtcc.c +6 −3
  2. tcc.h +1 −1
libtcc.c+6−3
@@ -239,7 +239,7 @@ PUB_FUNC char *tcc_strdup(const char *str) · 238 unmodified lines
239239 return ptr;
240240 }
241241
242−PUB_FUNC void tcc_memstats(void)
242+PUB_FUNC void tcc_memstats(int bench)
243243 {
244244 }
245245
@@ -400,7 +400,7 @@ PUB_FUNC char *tcc_strdup_debug(const char *str, const char *file, int line) · 154 unmodified lines
400400 return ptr;
401401 }
402402
403−PUB_FUNC void tcc_memstats(void)
403+PUB_FUNC void tcc_memstats(int bench)
404404 {
405405 if (mem_cur_size) {
406406 mem_debug_header_t *header = mem_debug_chain;
@@ -414,6 +414,8 @@ PUB_FUNC void tcc_memstats(void) · 7 unmodified lines
414414 header = header->next;
415415 }
416416 }
417+ else if (bench)
418+ fprintf(stderr, "mem_max_size= %d bytes\n", mem_max_size);
417419 }
418420
419421 #undef MEM_DEBUG_MAGIC1
@@ -1211,6 +1213,7 @@ LIBTCCAPI TCCState *tcc_new(void) · 791 unmodified lines
12111213 LIBTCCAPI void tcc_delete(TCCState *s1)
12121214 {
12131215 int i;
1216+ int bench = s1->do_bench;
12141217
12151218 tcc_cleanup();
12161219
@@ -1266,7 +1269,7 @@ LIBTCCAPI void tcc_delete(TCCState *s1) · 49 unmodified lines
12661269
12671270 tcc_free(s1->sym_attrs);
12681271 tcc_free(s1);
1269− tcc_memstats();
1272+ tcc_memstats(bench);
12701273 }
12711274
12721275 LIBTCCAPI int tcc_add_include_path(TCCState *s, const char *pathname)
tcc.h+1−1
@@ -1087,7 +1087,7 @@ PUB_FUNC char *tcc_strdup_debug(const char *str, const char *file, int line); · 1086 unmodified lines
10871087 #define realloc(p, s) use_tcc_realloc(p, s)
10881088 #undef strdup
10891089 #define strdup(s) use_tcc_strdup(s)
1090−PUB_FUNC void tcc_memstats(void);
1090+PUB_FUNC void tcc_memstats(int bench);
10911091 PUB_FUNC void tcc_error_noabort(const char *fmt, ...);
10921092 PUB_FUNC NORETURN void tcc_error(const char *fmt, ...);
10931093 PUB_FUNC void tcc_warning(const char *fmt, ...);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t