public void testQueue() {
Queue<String> q = new ConcurrentLinkedQueue<String> ();
String t;
while (true)
{
t = q.poll();
if (t != null)
{
System.out.print(t);
}
t = null;
}
}
Long term running loop with regular calling ConcurrentLinkedQueue.poll method.
In objective-c this code very fast allocate to much memory, more then 640Mb and iOS closes application. I've found that the similar problem was already fixed https://github.com/google/j2objc/issues/609 . Could some one check this example and tell me if the problem is in my code or this is a j2objc problem. I've tried j2objc-1.0.1 and the latest one 1.1 versions.
Thanks.
If your application or thread is long-lived and potentially generates a lot of autoreleased objects, you should periodically drain and create autorelease pools (like the Application Kit does on the main thread); otherwise, autoreleased objects accumulate and your memory footprint grows.