Many thanks. The second solution I was perfectly fine. If anyone will read this, you need to add 'RVItem' in uses, if will give an error on undeclared variable 'rvepShared'.
In the beginning I did the first one, which had seen many times on the Internet, but it used a lot of memory.
procedure ...