[bug report] regexp memory leak

Pierre Alexandre Tremblay's icon

It seems we have found a serious problem in regexp. The attached patch should be self-explanatory - we had to use osc-route in the end, sadly route does not do all what we need...

To reproduce: click on the bang of each column to see how (noparsing) (route) (regexp) (osc-route) perform.

For the surprise, click another time on each (coll is slow!!!)

For the best surprise, click a third time: all behave as the first time, except regexp. Click a fourth time for even longer fun!

Max Patch
Copy patch and select New From Clipboard in Max.

Pierre Alexandre Tremblay's icon

forgot to say: Max 6 and 7, 32 and 64 bit. All consistent.

vichug's icon

afair it's a well known and old problem (the characters hash table ?...). Fwiw did you try the odot externals ? maybe they have what you need.

Pierre Alexandre Tremblay's icon

sorry I did search the forum and found nothing with regexp memory leak... any hope of getting a fix?

vichug's icon

i searched too and didn't find the topic in which i think i remember the talk about regex and its woes (maybe it's my memory ?..) ; but oddly enough there's this line :
• regexp: fixed memory leak
in https://cycling74.com/forums/max-6-1-9-released/ .
By the way i can totally reproduce this bug

vichug's icon

oh, this paragraph in this oooold topic :

( ) create a backreference (it will memorize that portion of
text, it’s also a way of grouping element so you can apply quantifiers
(?, *, +, {}). The problem with those is that it consume memory
because it have to memorize the all thing

so, that may be the source of the problem here ?

Pierre Alexandre Tremblay's icon

the problem is that that memory should have been flushed with a new message in - it is pilling up for nothing (apart for making it unuseable)...