From 152397e641e9d1e6a11f80e24f562c4cf2472a2f Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Wed, 8 Mar 2017 12:00:42 +0100 Subject: yet another revision of memory limiting: the glibc mallinfo() approach has been shown to be unacceptably broken, so the fallback implementation has been improved * mallinfo() is not only broken on 64-bit systems but slows things down linearilly to the memory size of the process. E.g. after 500000<%A>, SciTECO will act sluggish! Shutting down afterwards can take minutes... mallinfo() was thus finally discarded as a memory measurement technique. * Evaluating /proc/self/statm? has also been evaluated and discarded because doing this frequently is even slower. * Instead, the fallback implementation has been drastically improved: * If possible use C++14 global sized deallocators, allowing memory measurements across the entire C++ code base with minimal runtime overhead. Since we only depend on C++11, a lengthy Autoconf check had to be introduced. * Use malloc_usable_size() with global non-sized deallocators to measure the approx. memory usage of the entire process (at least the ones done via C++). The cheaper C++11 sized deallocators implemented via SciTECO::Object still have precedence, so this affects Scintilla code only. * With both improvements the test case sciteco -e '<@EU[X^E\a]"^E\a"%a>' is handled sufficiently well now on glibc and performance is much better now. * The jemalloc-specific technique has been removed since it no longer brings any benefits compared to the improved fallback technique. Even the case of using malloc_usable_size() in strict C++ mode is up to 3 times faster. * The new fallback implementation might actually be good enough for Windows as well if some MSVCRT-specific support is added, like using _msize() instead of malloc_usable_size(). This must be tested and benchmarked, so we keep the Windows-specific implementation for the time being. --- src/interface-gtk/Makefile.am | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/interface-gtk') diff --git a/src/interface-gtk/Makefile.am b/src/interface-gtk/Makefile.am index dc4da3a..aa42871 100644 --- a/src/interface-gtk/Makefile.am +++ b/src/interface-gtk/Makefile.am @@ -5,6 +5,9 @@ AM_CXXFLAGS = -std=c++11 -Wall -Wno-char-subscripts if CLANG AM_CXXFLAGS += -Wno-mismatched-tags endif +if HAVE_SIZED_DEALLOCATION +AM_CXXFLAGS += -fsized-deallocation +endif EXTRA_DIST = gtk-info-popup.gob \ gtk-canonicalized-label.gob -- cgit v1.2.3