TBits SetBitNumber crash

I am using an one dimensional array of TBits as a branch of a tree for our DAQ program. It works fine but randomly there is a segmentation fault when the SetBitNumber function is called. The debugger shows the point of crash at somewhere close to the line:
fAllBits = new UChar_t[new_size];
in the TBits class (line number205 in TBits.h)
I have not split the branch and have kept the buffer size quite huge.
Is this a sign of some memory problem? How do I overcome this?
ROOT 5.32
Ubuntu 10.04
Thanks
Samuel

Hi,

Can you run valgrind on your failing example? (i.e. yes I think it is a memory problem).

Cheers,
Philippe.