I have this down to the use of R_alloc in the vect() function (line
40, optim.c). Replacing with S_alloc (which zeros memory) removes the
issue for me on this machine and on the Opteron. Could you please
verify on other platforms? And if anyone actually understands the code
could you verify that it makes sense to require the workspace to be
initialized?
Zeroing the workspace is not a requirement of the original L-BFGS-B code
that I can see. Given that it was originally in Fortran, and Fortran
often does zero it seems a likely symptom, but it does mean that a
variable is being used uninitialized somewhere in the code (converted to
C). It would be better to leave vect alone and to zero the workspace with
a memset call in lbfgsb. (Incidentally, I don't know why S_alloc does not
use memset -- we do require standard C and use in seeral other places.)