Store the length of the static argv when first allocated.
Add regression test for issue #1939