summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ChangeLog9
-rw-r--r--src/unexw32.c4
-rw-r--r--src/w32heap.c13
-rw-r--r--src/w32heap.h1
4 files changed, 27 insertions, 0 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 5189712d490..463f5750652 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,12 @@
+2014-05-29 Eli Zaretskii <eliz@gnu.org>
+
+ * w32heap.c (report_temacs_memory_usage): New function.
+
+ * unexw32.c (unexec) [ENABLE_CHECKING]: Call
+ report_temacs_memory_usage.
+
+ * w32heap.h (report_temacs_memory_usage): Add prototype.
+
2014-05-29 Paul Eggert <eggert@cs.ucla.edu>
Don't substitute sigprocmask for pthread_sigmask (Bug#17561).
diff --git a/src/unexw32.c b/src/unexw32.c
index 60b926b2499..7cbd95a46fe 100644
--- a/src/unexw32.c
+++ b/src/unexw32.c
@@ -728,6 +728,10 @@ unexec (const char *new_name, const char *old_name)
abort ();
strcpy (p, q);
+#ifdef ENABLE_CHECKING
+ report_temacs_memory_usage ();
+#endif
+
/* Make sure that the output filename has the ".exe" extension...patch
it up if not. */
p = out_filename + strlen (out_filename) - 4;
diff --git a/src/w32heap.c b/src/w32heap.c
index 7cce7c50319..be097901747 100644
--- a/src/w32heap.c
+++ b/src/w32heap.c
@@ -448,6 +448,19 @@ free_before_dump (void *ptr)
}
}
+#ifdef ENABLE_CHECKING
+void
+report_temacs_memory_usage (void)
+{
+ /* Emulate 'message', which writes to stderr in non-interactive
+ sessions. */
+ fprintf (stderr,
+ "Dump memory usage: Heap: %" PRIu64 " Large blocks(%lu): %" PRIu64 "\n",
+ (unsigned long long)committed, blocks_number,
+ (unsigned long long)(dumped_data + DUMPED_HEAP_SIZE - bc_limit));
+}
+#endif
+
/* Emulate getpagesize. */
int
getpagesize (void)
diff --git a/src/w32heap.h b/src/w32heap.h
index 84a26f958d0..18b6c85c2de 100644
--- a/src/w32heap.h
+++ b/src/w32heap.h
@@ -41,6 +41,7 @@ extern void *mmap_realloc (void **, size_t);
extern void mmap_free (void **);
extern void *mmap_alloc (void **, size_t);
+extern void report_temacs_memory_usage (void);
/* Emulation of Unix sbrk(). */
extern void *sbrk (ptrdiff_t size);