billiob pushed a commit to branch master. http://git.enlightenment.org/apps/terminology.git/commit/?id=0c87de9f5edd2c21fd8eff010734ced14ea9fce0
commit 0c87de9f5edd2c21fd8eff010734ced14ea9fce0 Author: Boris Faure <[email protected]> Date: Sat Nov 23 23:06:34 2019 +0100 backlog: early work to have memory accounting of the backlogs --- src/bin/backlog.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/bin/backlog.c b/src/bin/backlog.c index e3e8136..131a2d5 100644 --- a/src/bin/backlog.c +++ b/src/bin/backlog.c @@ -9,6 +9,15 @@ static int ts_uncomp = 0; static int ts_freeops = 0; static Eina_List *ptys = NULL; +static int64_t mem_used = 0; + +static void +_accounting_change(int64_t diff) +{ + mem_used += diff; +} + + void termpty_save_register(Termpty *ty) { @@ -41,6 +50,7 @@ termpty_save_new(Termpty *ty, Termsave *ts, int w) if (!cells ) return NULL; ts->cells = cells; ts->w = w; + _accounting_change(w * sizeof(Termcell)); return ts; } @@ -57,7 +67,9 @@ termpty_save_expand(Termpty *ty, Termsave *ts, Termcell *cells, size_t delta) 0, delta * sizeof(Termcell)); TERMPTY_CELL_COPY(ty, cells, &newcells[ts->w], (int)delta); + _accounting_change(-1 * ts->w * sizeof(Termcell)); ts->w += delta; + _accounting_change(ts->w * sizeof(Termcell)); ts->cells = newcells; return ts; } @@ -77,6 +89,7 @@ termpty_save_free(Termpty *ty, Termsave *ts) } free(ts->cells); ts->cells = NULL; + _accounting_change(-1 * ts->w * sizeof(Termcell)); ts->w = 0; } --
