• Join/Login
  • Business Software
  • Open Source Software
  • For Vendors
  • Blog
  • About
  • More
    • Articles
    • Create
    • SourceForge Podcast
    • Site Documentation
    • Subscribe to our Newsletter
    • Support Request
SourceForge logo
For Vendors Help Create Join Login
SourceForge logo
Business Software
Open Source Software
SourceForge Podcast
Resources
  • Articles
  • Case Studies
  • Blog
Menu
  • Help
  • Create
  • Join
  • Login
  • Home
  • Browse
  • FMSLogo
  • Bugs
FMSLogo

"APPLY [ [] [unknown] ] []" leaks memory

A Logo programming environment for Microsoft Windows

Brought to you by: david_costanzo
  • Summary
  • Files
  • Reviews
  • Support
  • Tickets ▾
    • Feature Requests
    • Bugs
    • Support Requests
  • Discussion
  • Code
Menu ▾ ▴
  • Create Ticket
  • View Stats

Group

  • v_6.06x
  • v_6.07.X
  • v_6.08.X
  • v_6.10.X
  • v_6.11.X
  • v_6.13.X
  • v_6.22.X
  • v_6.25.X
  • v_6.26.X
  • v_6.27.X
  • v_6.28.X
  • v_6.29.X

Searches

  • Changes
  • Closed Tickets
  • Open Tickets

Help

  • Formatting Help

#620 "APPLY [ [] [unknown] ] []" leaks memory

v_6.06x
closed-fixed
nobody
None
5
2026-07-06
2026-06-03
David Costanzo
No

If APPLY attempts to run a "named slot template" instruction list and it has an unknown procedure, FMSLogo leaks memory.

I have reproduced this as far back as FMSLogo 6.11.0. In FMSLogo 6.10.1, the leak is not reproducible. A leak is reproducible in MSWLogo 6.5b, but I suspect that's a different memory leak that was fixed before FMSLogo 6.10.0.

How Reproducible:
Every Time

Steps to Reproduce:

SHOW NODES
REPEAT 1000 [ CATCH "error (LIST "APPLY (LIST [] (LIST "unknown) ) [] ) ]
SHOW NODES

What Happens:
The first item in the second NODES printout is several thousand larger than the first item in the first NODES printout

Expected Result:
The first item in the second NODES printout is about the same (within a hundred) of the first item in the first NODES printout.

Related

Bugs: #249

Discussion

  • David Costanzo

    David Costanzo - 2026-06-15

    The bug is not limited to an unknown procedure, it seems like any "named slot template" instruction will cause it. For example, this also reproduces the leak:

    SHOW NODES
    REPEAT 1000 [ APPLY (LIST [] (LIST "IGNORE 1) ) [] ]
    SHOW NODES
    

    At first glance of the leaked nodes, it looks the node representing the anonymous function is leaked because the "treeification" creates a circular reference that is only broken if the node is explicitly untreeified.

    In looking at CHANGELOG.TXT for version 6.11.0, I don't see anything that could have introduced this.

     
    If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
  • David Costanzo

    David Costanzo - 2026-07-06
    • status: open --> closed-fixed
     
    If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
  • David Costanzo

    David Costanzo - 2026-07-06

    This is fixed by combination of [r6323], [r6326], [r6332], and [r6343]. The fix will be available in FMSLogo 8.6.0.

    The problem was a cycle that was created in the treeification of a procedure body. Each line in the bodylist became a TREE, which is used to get the parse tree of the line. In turn, the first expression each TREE was made into a LINE, which has a reference back to the bodylist line. This was introduced in 6.11.0 by [r1570] in a fix for Bug #126 that made FMSLogo look more like UCBLogo. This change removed code from treeify_bodylist() that untreeified the line after treeifying it. The correponding code is commented in out in make_tree_from_body() in paren.c in UCBLogo, which is why I removed it from FMSLogo:

            if (generation__tree(car(body_ptr)) == UNBOUND)
            setgeneration__tree(body, UNBOUND);
    /*      untreeify(car(body_ptr));   */
            while (cdr(tree) != NIL)
            tree = cdr(tree);
            end_ptr = tree;
    

    The circular reference is not a problem in UCBLogo because it has a mark-and-sweep garbage collector. It's a problem in FMSLogo because it uses reference counting and so the circular reference must be broken by an explicit untreeify call. I couldn't find a place to untreeify anonymous procedures, so I thought it was better not to have a cycle in the first place. Overall, this made the code base simpler because it made the structure of a treeified procedure simpler and removed the need to untreeify when procedures are cleaned up.

    It seems silly to treeify the line, then untreeify it, so I reworked the treeification process to be able to create the tree of a line without making it a TREE.

     

    Related

    Bugs: #126
    Commit: [r1570]
    Commit: [r6323]
    Commit: [r6326]
    Commit: [r6332]
    Commit: [r6343]

    If you would like to refer to this comment somewhere else in this project, copy and paste the following link:

Log in to post a comment.

SourceForge
  • Create a Project
  • Open Source Software
  • Business Software
  • Top Downloaded Projects
Company
  • About
  • Team
  • SourceForge Headquarters
    1320 Columbia Street Suite 310
    San Diego, CA 92101
    +1 (858) 422-6466
Resources
  • Support
  • Site Documentation
  • Site Status
  • SourceForge Reviews
SourceForge logo
© 2026 Slashdot Media. All Rights Reserved.
Terms Privacy Opt Out Advertise

Cerberus Logo