[nio-devel] NIO memory leak patch
Risto Laakso
risto.laakso at gmail.com
Thu Sep 28 20:50:18 UTC 2006
Hello,
thanks for the patch; I had marked to my to-do that:
"- current nio is leaking memory:
1) foreign read buffer is not freed when async-fd is closed;
2) foreign write buffers (created in map-to-foreign) aren't freed,
there's just code to (remove-if #'buffer-written buffers). "
but haven't had time to fix it. I think your patch fixes both cases.
Thanks,
Risto
2006/9/28, Nonny Mouse <enonymoos at gmail.com>:
> Hi All,
>
> Had a look over the NIO work, running ab2(apache-bench -
> http://httpd.apache.org/docs/2.2/programs/ab.html) )
> 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)))))))
>
> _______________________________________________
> nio-devel mailing list
> nio-devel at common-lisp.net
> http://common-lisp.net/cgi-bin/mailman/listinfo/nio-devel
>
>
>
More information about the Nio-devel
mailing list