memory leaks - What diagnostic tools are available for Node.js applications? -


there many tools out there, diagnostics tools diagnostic memory leak issues node.js applications?

yes, idde powerful tool not memory leak detection, wide variety of problem determination of node.js misbehaviors, including crashes , hangs.

here link overview, installation, , new information: https://www.ibm.com/developerworks/java/jdk/tools/idde

  1. i start nodeoverview command. note every command starts bang (!) , every command entered control (ctrl+enter) reasons.

!nodeoverview {

heap , garbage collection

memory allocator, used: 981 mb, available: 482 mb gc count: 144

this shows occupancy of heap.

  1. then, use jsmeminfo figure out predominent resident objects in heap.

    !jsmeminfo {

    memory allocator, used: 981 mb, available: 482 mb total heap objects: 21559924

    largest 5 heap objects type size (bytes) more information


    0x00000000de06d319 fixed_array_type 131112 !array 0x00000000de06d319 0x00000000de0ac6d9 fixed_array_type 98360 !array 0x00000000de0ac6d9 0x00000000e90e2f09 ascii_string_type 48152 !string 0x00000000e90e2f09 0x00000000e9035099 ascii_string_type 48088 !string 0x00000000e9035099 0x00000000e9004101 ascii_string_type 40936 !string 0x00000000e9004101

    most frequent 5 object types frequency


    js_object_type 15371393 fixed_array_type 6175379 ascii_internalized_string_type 3476 byte_array_type 1572 js_function_type 1434

    }

  2. review application based on information , see holding memory shown justified or not.

  3. if want 'dissect' objects further see content, use object expansion commands such !jsobject or !array:

    !array 0x00000000de06d319 {

    array type : fixed_array_type len : 16387 showing first 100 elements 0 : 0xd9400000000 (smi) 1 : 0x3fe00000000 (smi) 2 : 0x400000000000 (smi) 3 : 0x9a1103d1 (ascii_internalized_string_type : !print 0x000000009a1103d1 ) 4 : 0x9a1042a9 (ascii_internalized_string_type : !print 0x000000009a1042a9 ) ... }

  4. if want 'segregate' entire heap sections based on object's internal types, user jsgroupobjects. more useful when have multiple dumps taken @ different time intervals, , want compare objects grew on time.

    !jsgroupobjects {

    representative object address object type num objects constructor num properties properties


    !jsobject 0x00000000c8244fd1 js_object_type 6133503 object 0
    !jsobject 0x00000000c8004161 js_object_type 6133499 database 0
    !jsobject 0x00000000c8004101 js_object_type 3066750 myrecord 0
    !jsobject 0x00000000c869b111 js_object_type 37302 object 0
    !jsobject 0x00000000de05b959 js_function_type 542 0
    !jsobject 0x00000000de04bcc1 js_function_type 267 0
    !jsobject 0x00000000de04aa09 js_function_type 251 0
    !jsobject 0x00000000de04a911 js_function_type 227 0
    !jsobject 0x00000000de0a48c9 js_array_type 190 array 0
    !jsobject 0x00000000de04a7e9 js_function_type 102 0
    !jsobject 0x00000000de04e379 js_array_type 34 array 0
    !jsobject 0x00000000de050db1 js_object_type 30 object 0
    !jsobject 0x00000000c2938151 js_regexp_type 18 regexp 0
    !jsobject 0x00000000c2955a11 js_object_type 15 nativemodule 0
    !jsobject 0x00000000c2944519 js_object_type 11 object 0
    !jsobject 0x00003abc617bee71 js_object_type 102 callsite 3 receiver, fun, pos

  5. if want examine single object, jsobject on object address.

    !jsobject 0x00003abc617bee71 {

    object has fast properties number of descriptors : 3

    name value more information


    receiver 0x0000251abe506c91
    fun 0x00003abc617bb241 pos 0x00001dfd00000000 smi = 0x1dfd

    }


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -