I was using those functions to consume data from an encoded string. D=.
Currently, I can't test this but does it cause memory leak on arrays? Also, could you check this method? maybe this could be an alternative for strings.
DEF myShift(S$)
VAR R$=S$[0]
S$[0]=""
RETURN R$
END
@raimondz
Your function only works if you're parsing a string var, however, returns "Type Mismatch" if you're parsing a string directly. Seems that the " S$[0]="" " doesn't work in that case.
Luckily this memory leak isn't triggered by anything USEFUL. It only happens with string literals, which you shouldn't be using SHIFT or POP with anyway.