c# - Memory fragmentation? -


i'm not sure because don't have experience in analysing memory dumps, think may have problems memory fragmentation.

during load tests see memory usage growing point application restarts. asp.net mvc 4 app on 64 bit machine. wasn't involved in writing it. asked try analyze memory dumps.

so during last load test created 3 memory dumps (below sizes , total gc heap size output eeheap -gc):

  1. 1.70gb, 292mb
  2. 2.03gb, 337mb
  3. 2.55gb, 347mb

so see managed heap isn't growing as dump files. when dumpheap -stat see space used free objects (below each dump file)

  1. 147mb
  2. 145mb
  3. 213mb
 fragmented blocks larger 0.5 mb:             addr     size      followed 000000bcc668e0a8    0.7mb 000000bcc6738650 system.object[] 000000bcc6949f88    4.4mb 000000bcc6dab820 system.collections.specialized.nameobjectcollectionbase+nameobjectentry 000000bd4626c4b8    0.7mb 000000bd463165f8 system.byte[] 000000bd463fcc48   51.5mb 000000bd4977baf0 system.threading.threadstart 000000be463600c8    0.7mb 000000be464108f0 free 000000bec67e50e0    1.1mb 000000bec690b020 system.collections.generic.list`1[[ourtype, anotherourtype]] 000000bec690b0b8    3.2mb 000000bec6c3b170 system.byte[] 000000bfc6605e00    1.0mb 000000bfc6710190 free 000000bfc6743c58   32.8mb 000000bfc8806fe8 system.threading.executioncontext 000000c046200580    1.0mb 000000c0462ff2a0 someourtype 000000c0463a1270    3.6mb 000000c046732ac0 microsoft.win32.safehandles.safecapikeyhandle 

from understand not problem when free objects small fraction of total amount of memory in heap sizes. here looks problem.

app using 2 external libraries. 1 creating pdf-s , other creating barcode files. barcode library throwing accessviolationexception (about 70 times 2200 attempts). throws stacktrace

system.accessviolationexception: attempted read or write protected memory. indication other memory corrupt.    @ system.drawing.safenativemethods.gdip.intgdipdeletegraphics(handleref graphics)    @ system.drawing.graphics.dispose(boolean disposing)    @ system.drawing.graphics.dispose()    @ lesnikowski.barcode.basebarcode.render()    @ lesnikowski.barcode.basebarcode.save(stream stream, imagetype imagetype) 

i've read memory fragmentation caused pinning memory, !gchandles output

 handles:     strong handles:       154     pinned handles:       23     ref count handles:    2     weak long handles:    1794     weak short handles:   74     sizedref handles:     17     dependent handles:    1 

i don't know else can check. have memory fragmentation problem? can point me in direction?

edit: attach performance counters collected during load test. weird because it's showing lot of pinned objects !gchandles didn't show them.

enter image description here

 red line   - user load green line - bytes in heaps blue line  - pinned objects 

edit2: added fragmented blocks larger 0.5 mb: output !dumpheap -stat

you should use !address -summary idea of virtual memory usage in process. though there seems heap fragmentation, there additional heavy memory consumer in process. win32 heap, thread stacks, assemblies loading dynamically, , on.

for each type of leak have follow different approach. win32 heap inspection, should use variations of !heap command - !heap -stat, !heap -s -h 0. assembly loading issues, should @ loader heap !eeheap -loader , inspect various appdomains have !dumpdomain see assemblies loading. these examples - have provide more details situation.


Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -