On Wed, Jun 19, 2013 at 7:50 AM, Michal Labedzki
<michal.labedzki@xxxxxxxxx> wrote:
> Hi,
> I have a problem. For example packet-btavctp.c, I created emem tree in
> proto_register_btavctp(). And it is ok. But after switch to wmem Wireshark
> fails (cannot run) with:
> "ERROR:wmem_scopes.c:96:wmem_file_scope: assertion failed: (in_file_scope)"
>
> This is my change:
> - reassembling = se_tree_create(EMEM_TREE_TYPE_RED_BLACK, "btavctp
> reassembling");
> + reassembling = wmem_tree_new(wmem_file_scope());
So se_tree had two functions that were sort of confused:
se_tree_create_non_persistent() and se_tree_create().
se_tree_create_non_persistent() behaves how you would kind of expect
se_tree_create() to behave - it creates a tree that is completely gone
when the file closes. The function se_tree_create() does some magic
though, it creates a tree that doesn't disappear when the file closes,
it simply empties. The tree still exists, it just has no more entries
(so you can insert more into it for the next file).
I've tried to make that behaviour more obvious in wmem:
- wmem_tree_new() takes a single scope and has the simple obvious
behaviour - when the scope is emptied the tree is entirely gone.
- wmem_tree_new_autoreset() takes two scopes and does the same magic
that se_tree_create() did - when the first 'master' scope is emptied
the tree is entirely gone, but when the second 'slave' scope is
emptied the tree simply resets itself so it is empty for further
usage.
So for migration (as of r50046, which fixed part of the scoping issue
you were seeing):
- se_tree_create_non_persistent() becomes wmem_tree_new(wmem_file_scope())
- se_tree_create() becomes wmem_tree_new_autoreset(wmem_epan_scope(),
wmem_file_scope())
Cheers,
Evan
> Or maybe should I do that in register_init_routine() now? (I do not try)
>
> By the way: switch from emem tree to wmem tree seems to be only done by
> replace all "emem_tree" and "se_tree" by "wmem_tree", expect function create
> tree, right?
>
>
> ___________________________________________________________________________
> Sent via: Wireshark-dev mailing list <wireshark-dev@xxxxxxxxxxxxx>
> Archives: http://www.wireshark.org/lists/wireshark-dev
> Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
> mailto:wireshark-dev-request@xxxxxxxxxxxxx?subject=unsubscribe