Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7189005
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T19:12:33+00:00 2026-05-28T19:12:33+00:00

I read about lexical-let’s memory leak, for example here: Are there any problems with

  • 0

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.

lambda-in-let.el

(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.

lambda-in-let.el

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T19:12:33+00:00Added an answer on May 28, 2026 at 7:12 pm

    I just found this in emacs-devel:

    When does Emacs Lisp's lexical-let leak memory?
    So… Is it true, that “variables bound with lexical-let are never
    released, even if they are never used”?

    Not that I know. Of course, this code is not bug-free, but I don’t know
    of any concrete case that bumps into such a bug.

    — Re: lexical-let cause memory leaks?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Having read about strong names in .NET here , for example, I have the
I read about adjustor thunk from here . Here's some quotation: Now, there is
Read about Server push here . I want to push data to client from
I read about using the CASE expression inside the WHERE clause here: http://scottelkin.com/sql/using-a-case-statement-in-a-sql-where-clause/ I'm
I read about Big-O Notation from here and had few questions on calculating the
I read about unions the other day( today ) and tried the sample functions
I read about OpenGL and about nvidia-cg-toolkit and other shaders, all contains lots of
I read about __packed__ from here and, I understood that when __packed__ is used
read about Pipeline pattern from here how to implement pipeline pattern in java? is
I read about this problem for the iPhone on the post here . The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.