Skip to content

Instantly share code, notes, and snippets.

@tkf
Created January 30, 2012 08:22
Show Gist options
  • Save tkf/1703325 to your computer and use it in GitHub Desktop.
Save tkf/1703325 to your computer and use it in GitHub Desktop.

Quick profile of lexical-let memory leak

do-collect.el:

http://farm8.staticflickr.com/7162/6788480891_0851c27cf7_b.jpg

do-collect-with-gc.el:

http://farm8.staticflickr.com/7030/6788481175_874b0bbc80_b.jpg

lambda-in-let.el

http://farm8.staticflickr.com/7004/6788481357_66245cc2be_b.jpg

lambda-in-let-with-gc.el

http://farm8.staticflickr.com/7035/6788481563_d7ff88d456_b.jpg
(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))) x))
(garbage-collect))
(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))) x)))
(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)))
(garbage-collect))
(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))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment