summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2018-04-10 12:04:27 +0200
committerBram Moolenaar <Bram@vim.org>2018-04-10 12:04:27 +0200
commit756ef113d14428e598274f87672d7f0e34ff9781 (patch)
tree691de69fe76419832fc1615ba934173823ac8998
parent672afb9f66c64e031a2b609bdee0cb873883c9ec (diff)
patch 8.0.1680: memory allocated by libvterm is not profiledv8.0.1680
Problem: Memory allocated by libvterm does not show up in profile. Solution: Pass allocater functions to vterm_new().
-rw-r--r--src/terminal.c26
-rw-r--r--src/version.c2
2 files changed, 24 insertions, 4 deletions
diff --git a/src/terminal.c b/src/terminal.c
index 1d81d8db56..69b3306a41 100644
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -39,14 +39,12 @@
*
* TODO:
* - Add a way to set the 16 ANSI colors, to be used for 'termguicolors' and in
- * the GUI.
+ * the GUI. #2747
* - Win32: Make terminal used for :!cmd in the GUI work better. Allow for
* redirection. Probably in call to channel_set_pipes().
* - implement term_setsize()
* - Copy text in the vterm to the Vim buffer once in a while, so that
* completion works.
- * - Adding WinBar to terminal window doesn't display, text isn't shifted down.
- * a job that uses 16 colors while Vim is using > 256.
* - in GUI vertical split causes problems. Cursor is flickering. (Hirohito
* Higashi, 2017 Sep 19)
* - after resizing windows overlap. (Boris Staletic, #2164)
@@ -3330,6 +3328,26 @@ static VTermParserCallbacks parser_fallbacks = {
};
/*
+ * Use Vim's allocation functions for vterm so profiling works.
+ */
+ static void *
+vterm_malloc(size_t size, void *data UNUSED)
+{
+ return alloc_clear(size);
+}
+
+ static void
+vterm_memfree(void *ptr, void *data UNUSED)
+{
+ vim_free(ptr);
+}
+
+static VTermAllocatorFunctions vterm_allocator = {
+ &vterm_malloc,
+ &vterm_memfree
+};
+
+/*
* Create a new vterm and initialize it.
*/
static void
@@ -3340,7 +3358,7 @@ create_vterm(term_T *term, int rows, int cols)
VTermState *state;
VTermValue value;
- vterm = vterm_new(rows, cols);
+ vterm = vterm_new_with_allocator(rows, cols, &vterm_allocator, NULL);
term->tl_vterm = vterm;
screen = vterm_obtain_screen(vterm);
vterm_screen_set_callbacks(screen, &screen_callbacks, term);
diff --git a/src/version.c b/src/version.c
index a044f09bc1..f0a21b3358 100644
--- a/src/version.c
+++ b/src/version.c
@@ -763,6 +763,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1680,
+/**/
1679,
/**/
1678,