[nio-devel] NIO memory leak patch

Nonny Mouse enonymoos at gmail.com
Thu Sep 28 20:39:41 UTC 2006


Hi All,

Had a look over the NIO work, running ab2(apache-bench -
http://httpd.apache.org/docs/2.2/programs/ab.html)<http://httpd.apache.org/docs/2.2/programs/ab.html%29>)
against it, and it seems to hold up pretty well when compared with
apache/mod_lisp2 and araneida (I'll post some results later on).

I ran into a memory leak, which the following patch fixed for me. The patch
is against the nio-20060204.tar.gz (doesn't look like the cvs is
up-to-date?) from the http://common-lisp.net/project/nio/ website.

I'm no lisp expert, so any feedback appreciated.

Cheers,

Paul.

nio-20060204$ diff async-fd.lisp.orig async-fd.lisp
184c184
<   (with-slots (write-queue read-fd write-fd) async-fd
---
>   (with-slots (write-queue read-fd write-fd foreign-read-buffer) async-fd
189a190
>        (foreign-free foreign-read-buffer)
216,220c217,226
<     ;; remove entries that have been fully written
<     (setf write-queue (remove-if #'(lambda (x)
<                                    (with-slots (size written) x
<                                      (= size written)))
<                                write-queue))
---
>     ;; remove (and dealloc buffers) of entries that have been fully
written
>     (let ((unfinished-entries NIL))
>       (setf write-queue
>           (nreverse
>            (dolist (entry write-queue unfinished-entries)
>              (with-slots (size written) entry
>                (if (= size written)
>                    (with-slots (buffer) entry
>                      (foreign-free buffer))
>                    (push entry unfinished-entries)))))))
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/nio-devel/attachments/20060928/05d87f60/attachment.html>


More information about the Nio-devel mailing list