Opened 4 years ago
Closed 4 years ago
#1772 closed defect (fixed)
importing the same module over and over eats up more and more memory
| Reported by: | sjamaan | Owned by: | |
|---|---|---|---|
| Priority: | major | Milestone: | 5.3 |
| Component: | unknown | Version: | 5.2.0 |
| Keywords: | Cc: | ||
| Estimated difficulty: | hard |
Description
Reported by "plugd" on IRC:
(import (chicken string)
(chicken gc)
(chicken io))
(let loop ()
(print (conc "Memory statistics: " (memory-statistics)))
(eval '(begin (import (chicken string)) (print "Hello.")))
(read-line)
(loop))
I checked, and CHICKEN 4 also exhibits this behaviour, so it's not something new we recently introduced (as I remember we've been putting some effort into optimizing library imports)
Change History (2)
comment:1 Changed 4 years ago by
| Milestone: | 5.4 → 5.3 |
|---|
comment:2 Changed 4 years ago by
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
Fixed with ff8a66a7bb180d7dce6c9a6d7cb3e5d6cb53c985
Note: See
TracTickets for help on using
tickets.

Ah, the optimization mentioned in the description was in
merge-se, which##sys#importdoes *not* use: it uses append, which is a bit of a naive way of extending the current environment. It's fine for locally scopedlets and such, which the compiler and interpreter do all over the place, but it's not fine when adding large amounts of identifiers in one go to an open-ended environment likeimportdoes.The fix is to call
merge-se; patch sent to chicken-hackers. Moving to the 5.3 milestone unless anyone objects.