I read about lexical-let's memory leak, for example here: Are there any problems with lexical-let or other cl-macros??? - Users list for the GNU Emacs text editor - ArchiveOrange
It says:
"Note that variables bound with lexical-let are never released, even if they are never used. Try
(loop for i from 1 to 100000 collect (lexical-let ((x i)) '()))
and watch it eat memory."
But I think this code eats memory just because the list made by loop grows. So, I wrote a few elisp codes to check when it occurs but I could not find a example of the leak.
This is how memory grows with time when I execute the code below.
(require 'cl)
(defvar num-loop-1 30)
(defvar num-loop-2 100000)
(loop for i from 1 to num-loop-1 do
(loop for j from 1 to num-loop-2 collect
(lexical-let ((x `(,i ,j))) (lambda () x))))
It looks like there is no leak.
See more examples here: https://gist.github.com/1703325
ADDED: This is how the first example eats memory. As I said, I think it is an artifact.