[Openmcl-devel] process-run-function and mach ports usage
gb at clozure.com
Thu Feb 17 16:28:38 CST 2011
Some things that have Mach ports associated with them and which are
created by PROCESS-RUN-FUNCTION aren't deallocated until the GC runs
and can prove that those things can no longer be referenced. I
generally see that the number of Mach ports visible to top increases
by 4 (pretty consistently) when a thread is created and decreases by 3
or 4 if (CCL:GC) is called in the listener after the thread exits.
(It may be necessary to type a few NILs to the REPL before calling the
GC, to ensure that the PROCESS object isn't sitting in */**/*** or
other REPL variables.) I don't understand why the GC doesn't always
free 4 ports (it seems to free 3 much more often), but I don't claim
to understand exactly what resources have ports associated with them
At this point, I'd probably say that it -looks- like there's a net loss
of ~1 port every time a thread is created and destroyed, but that isn't
entirely predictable I haven't looked at things over a long enough
period of time to have a sense of whether things are transient or whether
there's a true leak there.
(In the face of all this ignorance, I take comfort in the old adage that
says that "Mach sucks, but no one understands how.")
On Thu, 17 Feb 2011, Willem Rein Oudshoorn wrote:
> I am observing that in multithreaded applications the nr of used mach
> ports keep increasing indefinitely.
> Now I think this is not normal because other programs (non lisp) do
> not exhibit this behaviour. But I might be using threads wrong.
> Reproduction scenario
> 1. Run top and watch the #PRTS column
> 2. start ccl
> 3. the value in #PRTS column is about 185.
> 4. execute the following expresion
> (ccl:process-run-function "name" (lambda ()))
> 5. Notice the value in teh #PRTS column is 4 higher than beore
> 6. It goes never down.
> 7. It will increase 4 by every execution of the 'process-run-function'
> 1. Is this bad?
> 2. Is there some cleanup needed after doing process-run-function ?
> Oh, I tested this with:
> "Version 1.6-dev-r14302M-trunk (DarwinX8632)"
> "Version 1.6-dev-r14302M-trunk (DarwinX8664)"
> On Mac OS X 10.5.8
> Kind regards,
> Wim Oudshoorn.
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
More information about the Openmcl-devel