This is probably way off the mark, and something you have sure to have tried: changing the GC parameters? Or is this not possible on the Android? I assume this is Java 6?<div>How is Java started on Android or, perhaps better question, can you influence the GC parameters?<br>
<br><div class="gmail_quote">On Tue, Jun 15, 2010 at 02:36, Miguel Morales <span dir="ltr">&lt;<a href="mailto:therevoltingx@gmail.com">therevoltingx@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hi all,<br>
<br>
For the past few months I&#39;ve been developing a game using Android and<br>
the rabbitmq java client with fair results.<br>
Setting it up was fairly painless, however, I&#39;ve run into one issue<br>
that&#39;s making one of the key parts of my game suffer.<br>
In Android, every time the garbage collector runs, the CPU is busy for<br>
a few milliseconds, ~200ms.<br>
This slows the frame rate and causes the game to stutter for a bit.<br>
<br>
The problem is in consuming messages, I have a thread that simply<br>
reads from a queue as fast as it can delivers the body bytes to the<br>
game client.<br>
However, in the library there are a bunch of small allocations that<br>
happen which causes the GC to run at least once every 10 seconds,<br>
using both a consumer and a basicGet.<br>
<br>
I&#39;ve tried to look at the code and remove allocations, and have got<br>
the GC runs down to about 1 every 40 seconds. �Still, that GC runs and<br>
constant allocations<br>
are hindering my ability to render some decent maps on the older<br>
Android models (I use a G1)<br>
<br>
I also tried briefly to get the rabbitmq-c client working, and I was<br>
successful.<br>
However, I hit a roadblock when trying to send the body bytes back to<br>
the JVM using JNI.<br>
I keep running out of memory or crashing using a jbyteArray buffer.<br>
<br>
My C is pretty rusty so I was hoping someone had some suggestions<br>
regarding that.<br>
Ideally, I&#39;d just be able to get rid of the allocations while<br>
consuming messages, any help is appreciated!<br>
<br>
I&#39;ve created a test application for android to test out the different<br>
consuming implementations in github:<br>
<a href="http://github.com/therevoltingx/rabbitmq_android_test" target="_blank">http://github.com/therevoltingx/rabbitmq_android_test</a><br>
<br>
You can see how fiddling around with the internal java client code I<br>
was able to get rid of some allocations here (simply by caching<br>
Basic.Get):<br>
<a href="http://github.com/therevoltingx/rabbitmq_android_test/blob/master/src/com/diastrofunk/rabbitmqtest/JavaTests.java#L74" target="_blank">http://github.com/therevoltingx/rabbitmq_android_test/blob/master/src/com/diastrofunk/rabbitmqtest/JavaTests.java#L74</a><br>

<br>
You can see the C/JNI version here:<br>
<a href="http://github.com/therevoltingx/rabbitmq_android_test/blob/master/jni/ndktests.c" target="_blank">http://github.com/therevoltingx/rabbitmq_android_test/blob/master/jni/ndktests.c</a><br>
<br>
Any help in this would be appreciated!<br>
<br>
Thanks,<br>
Miguel<br>
<font color="#888888"><br>
--<br>
<a href="http://diastrofunk.com" target="_blank">http://diastrofunk.com</a>, <a href="http://developingthedream.blogspot.com/" target="_blank">http://developingthedream.blogspot.com/</a>,<br>
<a href="http://www.youtube.com/user/revoltingx" target="_blank">http://www.youtube.com/user/revoltingx</a>, ~Isaiah 55:8-9<br>
_______________________________________________<br>
rabbitmq-discuss mailing list<br>
<a href="mailto:rabbitmq-discuss@lists.rabbitmq.com">rabbitmq-discuss@lists.rabbitmq.com</a><br>
<a href="http://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss" target="_blank">http://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss</a><br>
</font></blockquote></div><br><br clear="all"><br>-- <br>---<br>John Apps<br>(49) 171 869 1813<br>
</div>