entity framework 4 - Why SaveChanges method takes up memory? -


while preparing large amount (several thousand rows) of data , insert them database through entity framework, creating entity objects or in-memory object-graphs doesn’t take memory, when savechanges() method called, on duration continues consume noticeable amount of memory until method returns.

what happens under-the-hood during period of savechanges() call causes memory consumption?

it depends on depth of object graph, deeper graph more memory going consumed. more costly operations happen after call savechanges following:

  • views generated queries: before ef can execute query against model, must generate a set of local query views access database. more complex object graph is, more complicated views, although can pre-generated improve performance.
  • queries prepared: ef composes query commands, generates command trees based on metadata etc. again, cost rises increased query complexity.

the cost of executing queries relatively low. see here more info.

in general, recommended use special strategies bulk inserting ef. see here.


Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -