How to garbage collect a direct buffer in Java

I suspect that somewhere your application has a reference to the ByteBuffer instance(s) and that is preventing it from being garbage collected. The buffer memory for a direct ByteBuffer is allocated outside of the normal heap (so that the GC doesn’t move it!!). However, the ByteBuffer API provides no method for explicitly disposing of / … Read more

How can I prevent CompileAssemblyFromSource from leaking memory?

I think I have a working solution. Thanks to everyone for pointing me in the right direction (I hope). Assemblies can’t be unloaded directly, but AppDomains can. I created a helper library that gets loaded in a new AppDomain and is able to compile a new assembly from code. Here’s what the class in that … Read more

Python – Working around memory leaks

You can use something like this to help track down memory leaks >>> from collections import defaultdict >>> from gc import get_objects >>> before = defaultdict(int) >>> after = defaultdict(int) >>> for i in get_objects(): … before[type(i)] += 1 … now suppose the tests leaks some memory >>> leaked_things = [[x] for x in range(10)] … Read more

Instances referenced by ‘bound_this’ only are not garbage collected

Your suspicions that this is not an actual memory leak but weirdness with chrome is correct. I recently ran across the same problem. IE11 will not show this.func = _.bind(this.func, this) as a memory leak while chrome will, even after you press the collect garbage button 100 times. It will show it even after you … Read more

Sidekiq not deallocating memory after workers have finished

Mike Perham who wrote Sidekiq addressed this here: http://www.mikeperham.com/2009/05/25/memory-hungry-ruby-daemons/ tl;dr version: MRI will not give the memory back, the most you can do is control the heap, and to do that, Ruby Enterprise Edition was suggested. Don’t know that any of this helps, but that is the situation – straight from the horse’s mouth.

The web application [] appears to have started a thread named [Abandoned connection cleanup thread] com.mysql.jdbc.AbandonedConnectionCleanupThread

See this answer. It seems that MySQL driver should be in {$TOMCAT]/lib shared between applications. Check that you are not including it with each application. At least it worked for me and I have been able to remove the warning. If you are using Maven mark the dependency as provided. UPDATE: root cause is that … Read more

Best time to invalidate NSTimer inside UIViewController to avoid retain cycle

You could avoid the retain cycle to begin with by, e.g., aiming the timer at a StatusUpdate object that holds a non-retained (weak) reference to your controller, or by having a StatusUpdater that is initialized with a pointer your controller, holds a weak reference to that, and sets up the timer for you. You could … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)