BeRo1985 / flre

FLRE - Fast Light Regular Expressions - A fast light regular expression library
GNU Lesser General Public License v2.1
94 stars 23 forks source link

var vs. out #16

Closed benibela closed 8 years ago

benibela commented 8 years ago

FPC always complains "Hint: Local variable "captures" does not seem to be initialized", can you use out parameters instead var for the matchings?

BeRo1985 commented 8 years ago

FLRE tries to reuse the last captures array of the previous call for as memory manager speed optimization, so you do should use Captures := nil; before the first MatchAll call.

FLRE is heavily optimized for reusing and caching of data (structures), because the best speed optimization is always to avoiding to do something unnecessary (=> to do nothing in these cases except reusing).

benibela commented 8 years ago

That seems like a good idea, but PtrMatchAll starts with SetLength(MultiCaptures,0);...

BeRo1985 commented 8 years ago

I've fixed that some minutes ago :) That was still left over things from memory leak debugging sessions, which I've forgot to remove it again.