Code Select
> (new-class 'Foo)
Foo
> (setf f (instantiate Foo))
Foo#1
> (deallocate f)
true
> (context? f)
true
> (symbols f)
ERR: context expected in function symbols : f
You need
For this one ObjNL.lsp is also needed, simply because it's much easier to demonstrate the leak by using auto-release pools:
Code Select
> (new-class 'Foo)
Foo
> (define (inflate-memory) (push-autorelease-pool) (dotimes (_ 10000) (autorelease (instantiate Foo))) (pop-autorelease-pool))
(lambda () (push-autorelease-pool)
(dotimes (_ 10000)
(autorelease (instantiate Foo)))
(pop-autorelease-pool))
> (inflate-memory)
true
> (inflate-memory)
true
On my system using the 10.1.9-dev build, each time 'inflate-memory' is called an additional 0.1MB of memory is used up even though 'inflate-memory' cleans up after itself.
This one is quite significant:
Code Select
> (nil? (inc a))
nil
> a
2
Take a look at this REPL session:
Code Select
> [cmd]
(define-macro (epln what)
(when (nil? (println "n" what "n -> " (eval what)))
(exit)
)
)[/cmd]
[/cmd]
(lambda-macro (what)
(when (nil? (println "n" what "n -> " (eval what)))
(exit)))
nil
That shows one variant of the problem, where the ending [/cmd] tag isn't respected and must be entered again.
Note the 'nil' at the very end. This shows that newLISP is evaluating something... Here's a bizarre variant that shows some more insight to the problem:
Code Select
> [cmd](define-macro (epln what)
(when (nil? (println "n" what "n -> " (eval what)))
(exit)
)
)[/cmd]
[/cmd]
nil
-> nil
macbookpro:~$
Even though that should work, that will actually causes the 'epln' function to be evaluated, which is why it quits to the shell (because 'what' is nil).