# TEventList problem with subtraction

**URL:** <https://root-forum.cern.ch/t/teventlist-problem-with-subtraction/53047>\
**Category:** Newbie\
**Tags:** tree, bug\
**Created:** [January 10, 2023, 2:22pm UTC](https://root-forum.cern.ch/t/teventlist-problem-with-subtraction/53047 "2023-01-10T14:22:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![hvsouza](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/hvsouza/32/23711_2.png) [@hvsouza](https://root-forum.cern.ch/u/hvsouza)\
**Post date:** [January 10, 2023, 2:22pm UTC](https://root-forum.cern.ch/t/teventlist-problem-with-subtraction/53047/1 "2023-01-10T14:22:07Z")

</div>

Hello,

There’s something weird happening and I’m not sure if it’s a bug or if I’m doing something wrong.

I have a class using TEventList to make selections in a TTree.  
First I use the method `t1->Draw(">>lev","some_selection")` to get some events.

Then, I apply a second filter by subtracting a second TEventList from `lev` with some selection I made myself.

The problem comes when I want to “reset” the list. If I try to execute `t1->Draw(">>lev","")`, which would return me all the events, it gives me the error `corrupted size vs. prev_size`. Strangely, this error does not occur every time.

I could not create a script that would be able to reproduce the error. However, I have attached a script that comes pretty close. Execute it as `root test.C` and press anything after the script is executed. For me, the following message comes:

‘‘root.exe: malloc.c:2617: sysmalloc: Assertion `(old\_top == initial\_top (av) && old\_size == 0) || ((unsigned long) (old\_size) \>= MINSIZE && prev\_inuse (old\_top) && ((unsigned long) old\_end & (pagesize - 1)) == 0)’ failed.’’

PS.: With `.x text.C` or `.L test.C` it does not reproduce.

If one tries to execute line 22 in the terminal (removing it from the script), no error will follow. But, as soon as you press `.q`, the same `corrupted size vs. prev_size` error occurs (also with `.x` and `.L`)

* * *

_ROOT Version:_ 6.26/06  
_Platform:_ Ubuntu 22.04  
_Compiler:_ gcc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0  
[test.C](https://root-forum.cern.ch/uploads/short-url/nURA1tQpzW9DKj41euUnA4t6TvG.C) (454 Bytes)

* * *

---

<div class="post-metadata">

**Author:** ![bellenot](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/bellenot/32/29217_2.png) [@bellenot](https://root-forum.cern.ch/u/bellenot)\
**Post date:** [January 10, 2023, 2:48pm UTC](https://root-forum.cern.ch/t/teventlist-problem-with-subtraction/53047/2 "2023-01-10T14:48:10Z")

</div>

Maybe @pcanal can help
