简体   繁体   English

EF上下文的大小

[英]Size of EF context

My app uses Entity Framework. 我的应用程序使用实体框架。 As I perform operations on the Context, such as inserts/deletes/updates, due to its unity of work behavior im sure it occupies more and more memory as these operations take place. 当我在上下文上执行诸如插入/删除/更新之类的操作时,由于其工作行为的统一性,因此请确保在进行这些操作时它占用越来越多的内存。

My question here is: Is there a way to obtain how much memory is the context holding in a given moment? 我的问题是:有没有一种方法可以获取上下文在给定时刻所拥有的内存量?

Details: 细节:

  • No Lazy Loading being used 没有使用延迟加载
  • No Proxy Creation 没有代理创建
  • EF 4 EF 4

When you need to monitorize memory and CPU usage of objects within an application or service is a synonym of requiring a profiler . 当您需要监视应用程序或服务中对象的内存和CPU使用率时,它是需要探查器的同义词。

There're many options here. 这里有很多选择。 It's just about looking for ".NET profiler" in Google. 它只是在Google中寻找“ .NET探查器”

Note I'm redirecting you to Google to avoid spam. 请注意,为了避免垃圾邮件,我将您重定向到Google。

Answering to @Servy's concern: 回答@Servy的担忧:

Profilers are fine for a debugging tool during development. 探查器非常适合开发期间的调试工具。 It's not really something that you can use during the execution of the program outside of development. 在开发之外的程序执行期间,实际上并没有可以使用的东西。 I get the impression that that's what he's asking about. 我得到的印象就是他要问的。 -

It's when the requirement of implementing some kind of load tests arises. 这是实现某种负载测试的要求。 OP should implement some test cases which mimic real-world scenarios to get stats as close as possible to actual production execution of the same code. OP应该实现一些模拟真实场景的测试用例,以使统计数据尽可能接近实际生产相同代码的执行情况。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM