Commit de427584 authored by Morten Welinder's avatar Morten Welinder

Cells: use slice allocator, not g_new, for better behaviour.

parent c539532e
2011-03-10 Morten Welinder <terra@gnome.org>
* src/sheet.c (cell_new, cell_free): Use slice allocator, not
g_new.
2011-03-08 Andreas J. Guelzow <aguelzow@pyrshep.ca>
* src/sheet.c: formulas -> formulæ
* src/wbc-gtk-actions.c: formulas -> formulæ
2011-03-08 Morten Welinder <terra@gnome.org>
* src/gutils.c (gnm_insert_meta_date): Use GsfTimestamp, not
string.
* src/stf-parse.c (stf_parse_sheet): Delete lines as we are done
with them.
(stf_parse_general_free): Handle freed lines.
......
......@@ -3788,11 +3788,13 @@ sheet_cell_add_to_hash (Sheet *sheet, GnmCell *cell)
cell->base.flags |= GNM_CELL_IS_MERGED;
}
#define USE_CELL_POOL
#undef USE_CELL_POOL
#ifdef USE_CELL_POOL
/* The pool from which all cells are allocated. */
static GOMemChunk *cell_pool;
#else
static int cell_allocations = 0;
#endif
static GnmCell *
......@@ -3802,7 +3804,7 @@ cell_new (void)
#ifdef USE_CELL_POOL
go_mem_chunk_alloc0 (cell_pool)
#else
g_new0 (GnmCell, 1)
(cell_allocations++, g_slice_new0 (GnmCell))
#endif
;
......@@ -3820,7 +3822,7 @@ cell_free (GnmCell *cell)
#ifdef USE_CELL_POOL
go_mem_chunk_free (cell_pool, cell);
#else
g_free (cell);
cell_allocations--, g_slice_free1 (sizeof (*cell), cell);
#endif
}
......@@ -3850,8 +3852,12 @@ gnm_sheet_cell_shutdown (void)
go_mem_chunk_foreach_leak (cell_pool, cb_cell_pool_leak, NULL);
go_mem_chunk_destroy (cell_pool, FALSE);
cell_pool = NULL;
#else
if (cell_allocations)
g_printerr ("Leaking %d cells.\n", cell_allocations);
#endif
}
/****************************************************************************/
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment