Summary : bug fix for memory overflow check logic and DALimit's variable 54/26554/1
authorseokgil.kang <seokgil.kang@samsung.com>
Tue, 26 Aug 2014 09:16:30 +0000 (18:16 +0900)
committerseokgil.kang <seokgil.kang@samsung.com>
Tue, 26 Aug 2014 09:16:30 +0000 (18:16 +0900)
Change-Id: I904dd665ac7dd8108ce92713eea96d063e93c580
Signed-off-by: seokgil.kang <seokgil.kang@samsung.com>
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/common/DALimit.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/summary/leaks/LeakDataMaker.java

index 7cba071..e23c0d0 100644 (file)
@@ -50,17 +50,17 @@ public class DALimit {
        // common
        public static final int MAX_TRACE_TIME_INSECOND = 24*60*60;     // 1 day
        public static final long MAX_SEQUENCE_NUMBER = Long.MAX_VALUE; //2^63-1,  4G*2G-1
-       public static final int MAX_PROCESS_COUNT = 2^16;       // 65535
-       public static final int MAX_BINARY_COUNT = 2^16; // 65535
-       public static final int MAX_FUNCTION_COUNT = 2^20;      // 1,048,576
+       public static final int MAX_PROCESS_COUNT = (int) Math.pow(2, 16);      // 65535
+       public static final int MAX_BINARY_COUNT = (int) Math.pow(2, 16); // 65535
+       public static final int MAX_FUNCTION_COUNT = (int) Math.pow(2, 20);     // 1,048,576
        public static final int MAX_FUNCTION_ARGUMENTS_COUNT = FUNCTION_ARGUMENTS_FORMAT_LENGTH; // Because "MAX_FUNCTION_ARGUMENTS_COUNT < FUNCTION_ARGUMENTS_FORMAT_LENGTH" is always true
        
        // Leak 
-       public static final int MAX_LEAK_CHECK_BUFFER_SIZE = 2^20; // 1,048,576
+       public static final int MAX_LEAK_CHECK_BUFFER_SIZE = (int) Math.pow(2, 20); // 1,048,576
 
        // File Analysis
-       public static final int MAX_FILE_COUNT = 2^10; // 1024
-       public static final int MAX_FILE_STATUS_COUNT = 2^10*100; // 102400
-       public static final int MAX_FILE_ACCESSOR_COUNT = 2^10*100; // 102400
+       public static final int MAX_FILE_COUNT = (int) Math.pow(2, 10); // 1024
+       public static final int MAX_FILE_STATUS_COUNT = ((int) Math.pow(2, 10))*100; // 102400
+       public static final int MAX_FILE_ACCESSOR_COUNT = ((int) Math.pow(2, 10))*100; // 102400
        
 }
index c138373..1d229eb 100644 (file)
@@ -76,7 +76,8 @@ public class LeakDataMaker {
                for (int i = 0; i < size; i++) {
                        LogData input = (LogData) inputs.get(i);
                        if (input == null)      continue;
-                       checkHeapMemory();
+                       if (isHeapMemoryOverflow())
+                               break;
                        switch (leakDetector.runLeakDetect(input)) {
                        case LogCenterConstants.MEMORY_API_ALLOC: // alloc, realloc
                                makeAllocData(input);
@@ -125,7 +126,8 @@ public class LeakDataMaker {
                }
        }
 
-       private void checkHeapMemory() {
+       private boolean isHeapMemoryOverflow() {
+               boolean flag = false;
                if (leakDetector.getLeakHash().size() > DALimit.MAX_LEAK_CHECK_BUFFER_SIZE) {
                        ToolbarArea.getInstance().stopTrace();
                        Display.getDefault().asyncExec(new Runnable() {
@@ -139,7 +141,11 @@ public class LeakDataMaker {
                                        dialog.open();
                                }
                        });
-               }
+                       
+                       flag = true;
+               } 
+               
+               return flag;
        }
 
        public void makeAllocData(LogData log) {