<br><tt><font size=2>Hi Rich</font></tt>
<br>
<br><tt><font size=2>I saw, that you made a thread on java/threading/memory-leaks
&quot;on your own&quot;.</font></tt>
<br><tt><font size=2>Although I spend some time on the same issues in the
last years I can hardly </font></tt>
<br><tt><font size=2>give new input.</font></tt>
<br>
<br><tt><font size=2>Don't know wether you saw these:</font></tt>
<br><tt><font size=2>1. http://www.nabble.com/forum/ViewPost.jtp?post=5707320&amp;framed=y
</font></tt>
<br><tt><font size=2>&nbsp; &nbsp;We worked around threading-problems with
Java-synchronizing.</font></tt>
<br><tt><font size=2>&nbsp; &nbsp;By doing so, the application becomes
stable in stress-tests, but &nbsp;</font></tt>
<br><tt><font size=2>&nbsp; &nbsp;looses the ability to use many CPUs.</font></tt>
<br><tt><font size=2>&nbsp; &nbsp;(On the other hand: http://www.nabble.com/forum/ViewPost.jtp?post=15410399&amp;framed=y</font></tt>
<br><tt><font size=2>&nbsp; &nbsp; shows, that the mapserver-locks prevent
using many CPU's in any case.)</font></tt>
<br><tt><font size=2>2. You cited the post about the delete-problem. </font></tt>
<br><tt><font size=2>&nbsp; &nbsp;(http://www.nabble.com/forum/ViewPost.jtp?post=1548675&amp;framed=y)</font></tt>
<br><tt><font size=2>&nbsp; &nbsp;This issue was adressed in Mapserver
5.0:</font></tt>
<br><tt><font size=2>&nbsp; &nbsp;http://mapserver.gis.umn.edu/development/rfc/ms-rfc-24</font></tt>
<br><tt><font size=2>&nbsp; &nbsp;So the garbage-collector shouldn't crash
the jvm any more.</font></tt>
<br><tt><font size=2>&nbsp; &nbsp;(My personal opinion is to use delete
anyway, since freeing C-memory</font></tt>
<br><tt><font size=2>&nbsp; &nbsp; in the garbage-collector-thread sounds
dangerous to me. But as far</font></tt>
<br><tt><font size=2>&nbsp; &nbsp; as I know, there are no more documented
problems.)</font></tt>
<br><tt><font size=2>3. I also spent time in watching memory-leaks inside
Mapscript/java and abandoned </font></tt>
<br><tt><font size=2>&nbsp; &nbsp;valgrind-approach. Seemed to be to complex,
since much memory-handling of the JVM is </font></tt>
<br><tt><font size=2>&nbsp; &nbsp;documented. My approaches:</font></tt>
<br><tt><font size=2>&nbsp; &nbsp;Variant 1: In cases, where I had a guess
what to look for, I wrote a small C-program, which </font></tt>
<br><tt><font size=2>&nbsp; &nbsp; &nbsp;called the suspect functions and
analysed the behaviour of this small program.</font></tt>
<br><tt><font size=2>&nbsp; &nbsp; &nbsp;(Successfully used in http://trac.osgeo.org/mapserver/ticket/1662.)
</font></tt>
<br><tt><font size=2>&nbsp; &nbsp; &nbsp;Didn't use valgrind but memwatch
(http://www.linkdata.se/sourcecode.html). But this</font></tt>
<br><tt><font size=2>&nbsp; &nbsp; &nbsp;is purely a matter of taste.</font></tt>
<br><tt><font size=2>&nbsp; &nbsp; &nbsp;Disadvantage: Doesn't help, if
you have no guess.</font></tt>
<br><tt><font size=2>&nbsp; &nbsp;Variant 2: Watching memory-usage using
top from outside during stress-tests. With</font></tt>
<br><tt><font size=2>&nbsp; &nbsp; &nbsp;some awk-sed-batch-unix-stuff
it resulted in pictures like this:</font></tt>
<br><tt><font size=2>&nbsp; &nbsp; &nbsp;http://trac.osgeo.org/mapserver/attachment/ticket/1662/before-after.zip</font></tt>
<br><tt><font size=2>&nbsp; &nbsp; &nbsp;Disadvantage: Black box</font></tt>
<br>
<br><tt><font size=2>Sorry. That's hardly helpfull. But I'm interested
in your progress.</font></tt>
<br><tt><font size=2>Benedikt Rothe</font></tt>
<br>
<br><tt><font size=2>mapserver-users-bounces@lists.osgeo.org schrieb am
20.02.2008 02:26:04:<br>
<br>
&gt; <br>
&gt; Any advice about tracking down memory leaks that might exist in java<br>
&gt; mapscript?<br>
&gt; <br>
&gt; For the context of why I'm trying to do this, see the following thread:<br>
&gt; <br>
&gt; &nbsp; http://www.nabble.com/thread-safety-to15514019.html<br>
&gt; <br>
&gt; I installed the debian sarge backport of valgrind (valgrind-3.2.0-Debian),<br>
&gt; and<br>
&gt; tried invoking java prefaced with:<br>
&gt; <br>
&gt; &nbsp; valgrind --leak-check=full --smc-check=all -v<br>
&gt; <br>
&gt; No leaks were reported, but I don't think it really checked where
I wanted<br>
&gt; it<br>
&gt; to check. &nbsp;libmapscript.so is loaded with the following:<br>
&gt; <br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;System.loadLibrary(&quot;mapscript&quot;);<br>
&gt; <br>
&gt; And from the output it doesn't look like valgrind is actually instrumenting<br>
&gt; that library, and I can't figure out how to tell it to explicitly
instrument<br>
&gt; a<br>
&gt; dynamically loaded library.<br>
&gt; <br>
&gt; Yet the valgrind FAQ:<br>
&gt; <br>
&gt; &nbsp; http://valgrind.org/docs/manual/faq.html#faq.java<br>
&gt; <br>
&gt; does indicate that this might at least be possible:<br>
&gt; <br>
&gt; --- begin ---<br>
&gt; in theory Valgrind can run any Java program just fine, even those
that use<br>
&gt; JNI and are partially implemented in other languages like C and C++.
&nbsp;In<br>
&gt; practice, Java implementations tend to do nasty things that most programs<br>
&gt; do not, and Valgrind sometimes falls over these corner cases. <br>
&gt; --- end ---<br>
&gt; <br>
&gt; Sorry if this is more appropriately a valgrind question and not a
mapserver<br>
&gt; question, but I saw valgrind mentioned in a few places:<br>
&gt; <br>
&gt; &nbsp; HISTORY.TXT<br>
&gt; &nbsp; http://trac.osgeo.org/mapserver/ticket/2412<br>
&gt; <br>
&gt; so I thought that maybe someone here might have experience as it relates
to<br>
&gt; this specific case.<br>
&gt; <br>
&gt; - Rich<br>
&gt; <br>
&gt; -- <br>
&gt; View this message in context: http://www.nabble.com/detecting-<br>
&gt; memory-leaks-in-java-mapscript-tp15580371p15580371.html<br>
&gt; Sent from the Mapserver - User mailing list archive at Nabble.com.<br>
&gt; <br>
&gt; _______________________________________________<br>
&gt; mapserver-users mailing list<br>
&gt; mapserver-users@lists.osgeo.org<br>
&gt; http://lists.osgeo.org/mailman/listinfo/mapserver-users<br>
</font></tt>