[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v1 5/5] tests/plugins: make howvec clean-up after itself.
From: |
Robert Foley |
Subject: |
Re: [PATCH v1 5/5] tests/plugins: make howvec clean-up after itself. |
Date: |
Mon, 10 Feb 2020 14:34:50 -0500 |
On Fri, 7 Feb 2020 at 10:01, Alex Bennée <address@hidden> wrote:
>
> TCG plugins are responsible for their own memory usage and although
> the plugin_exit is tied to the end of execution in this case it is
> still poor practice. Ensure we delete the hash table and related data
> when we are done to be a good plugin citizen.
>
> Signed-off-by: Alex Bennée <address@hidden>
> ---
> tests/plugin/howvec.c | 12 +++++++++++-
> static void plugin_exit(qemu_plugin_id_t id, void *p)
> {
> g_autoptr(GString) report = g_string_new("Instruction Classes:\n");
> @@ -213,12 +220,15 @@ static void plugin_exit(qemu_plugin_id_t id, void *p)
> g_list_free(it);
> }
>
> + g_list_free(counts);
> + g_hash_table_destroy(insns);
> +
Just one minor comment. Seems like there might be an option to use
g_autoptr(GList) for counts.
Reviewed-by: Robert Foley <address@hidden>
> qemu_plugin_outs(report->str);
> }
>
> static void plugin_init(void)
> {
> - insns = g_hash_table_new(NULL, g_direct_equal);
> + insns = g_hash_table_new_full(NULL, g_direct_equal, NULL, &free_record);
> }
>
> static void vcpu_insn_exec_before(unsigned int cpu_index, void *udata)
> --
> 2.20.1
>
- [PATCH v1 0/5] plugins/next, Alex Bennée, 2020/02/07
- [PATCH v1 2/5] plugins/core: add missing break in cb_to_tcg_flags, Alex Bennée, 2020/02/07
- [PATCH v1 3/5] tests/plugin: prevent uninitialized warning, Alex Bennée, 2020/02/07
- [PATCH v1 4/5] target/riscv: progressively load the instruction during decode, Alex Bennée, 2020/02/07
- [PATCH v1 5/5] tests/plugins: make howvec clean-up after itself., Alex Bennée, 2020/02/07
- [PATCH v1 1/5] docs/devel: document query handle lifetimes, Alex Bennée, 2020/02/07
- Re: [PATCH v1 0/5] plugins/next, no-reply, 2020/02/07
- Re: [PATCH v1 0/5] plugins/next, no-reply, 2020/02/07