Monday, 30 November 2015

Garbage Collection Codes explaination while processing bitmaps in android

GC_FOR_MALLOC means that the GC was triggered because there wasn’t enough memory left on the heap to perform an allocation. Might be triggered when new objects are being created.

GC_EXPLICIT means that the garbage collector has been explicitly asked to collect, instead of being triggered by high water marks in the heap. Happens all over the place, but most likely when a thread is being killed or when a binder communication is taken down. Also when you use System.gc();

GC_CONCURRENT Triggered when the heap has reached a certain amount of objects to collect. This is the default garbage collection in Android version  2.2 and above.

GC_EXTERNAL_ALLOC means that the VM is trying to reduce the amount of memory used for collectable objects, to make room for more non-collectable. External Alloc is a telltale sign you may have too many bitmaps.

Check your Android Studio's/Eclipse's  Logcat which GC code it is showing and get explanation above.
Thanks and enjoy and please keep commenting.  

Monday, 17 August 2015

Setting tokens/terms to be logged for every message using log4j.properties

Format Specifier Description
%C The complete class name that has invoked the log
%d The timestamp when log request is invoked. Further customized using java's DateFormat style of abbreviations like %d{yyyy-MM-dd HH:mm:ss,SSS} which incidentally is the default used.
%F The source file name that makes the log request.
%l The source file name, method name and line number where log request is made.
%L The line number of the source file where log request is made.
%m The actual message logged.
%M The method name that makes the log request.
%n New line character
%p The log level used in the log request.
%r The time elapsed between start of the application and the log request in milliseconds.
%t The java thread name that nakes the log request.