Yahoo Web Search

Search results

  1. Sep 23, 2014 · I want to reduce the amount of memory consumed by the strings. I know .NET represents strings in UTF-16 encoding (2 byte per char). Most strings in my application contain pure english chars, so storing them in UTF-8 encoding will be 2 times more efficient than UTF-16.

    • Defining Memory Leaks in .NET
    • Detect A Memory Leak Problem with The Diagnostic Tool Window
    • Detect Memory Leak Problems with The Task Manager, Process Explorer Or Perfmon
    • Use A Memory Profiler to Detect Memory Leaks
    • Use “Make Object ID” to Find Memory Leaks
    • Beware of Common Memory Leak Sources
    • Use The Dispose Pattern to Prevent Unmanaged Memory Leaks
    • Add Memory Telemetry from Code
    • Test For Memory Leaks
    • Summary

    In a garbage collected environment, the term memory leaks is a bit counter intuitive. How can my memory leak when there’s garbage collector (GC) that takes care to collect everything? There are 2 related core causes for this. The first core cause is when you have objects that are still referenced but are effectually unused. Since they are reference...

    If you go to Debug | Windows | Show Diagnostic Tools, you’ll see this window. If you’re like me, you probably saw this tool window after installing Visual Studio, closed it immediately, and never thought of it again. The Diagnostic Tools Window can be quite useful though. It can easily help you detect 2 problems: Memory Leaks and GC Pressure. When ...

    The second easiest way to detect major memory leak problems is with the Task Manager or Process Explorer(from SysInternals). These tools can show the amount of memory your process uses. If it consistently increases over time, you probably have a memory leak. PerfMon is a bit harder to use but can show a nice graph of your memory usage over time. He...

    A memory profiler is like the Chef’s Knife of handling memory leaks. It’s the main tool to find and fix them. While other techniques can be easier to use or cheaper (profiler licenses are costly), it’s best to be proficient by with at least one memory profiler to effectively solve memory leak problems. The big names in .NET memory profilers are: do...

    In my last article 5 Techniques to avoid Memory Leaks by Events in C# .NET you should know I showed a technique to find a memory leak by placing a breakpoint in the class Finalizer. I’ll show you a similar method here that’s even easier to use and doesn’t require code changes. This one utilizes the Debugger’s Make Object ID feature and the Immediat...

    There’s always a risk of causing a memory leak, but there are certain patterns that are much more likely to do so. I suggest to be extra careful when using these, and proactively check for memory leaks with techniques like the last best practice. Here are some of the more common offenders: 1. Events in .NET are notorious for causing memory leaks. Y...

    Your .NET application constantly uses unmanaged resources. The .NET framework itself relies heavily on unmanaged code for internal operations, optimization, and Win32 API. Anytime you use Streams, Graphics, or Files forexample, you are probably executing unmanaged code. .NET framework classes that use unmanaged code usually implement IDisposable. T...

    Sometimes, you might want to periodically log your memory usage. Maybe you suspect your production Server has a memory leak. Perhaps you want to take some action when your memory reaches a certain limit. Or maybe you’re just in the good habit of monitoring your memory. There’s a lot of information we can get from the app itself. Getting current mem...

    It’s a great practice to proactively test for memory leaks. And it’s not that hard. Here’s a short pattern you can use: For more in-depth testing, memory profilers like SciTech’s .NET Memory Profiler and dotMemoryprovide a testing API:

    Don’t know about you, but my new year’s resolution is: Better memory management. I hope this post gave you some value and I’d love it if you subscribeto my blog or leave a comment below. Any feedback is welcome.

  2. Oct 17, 2023 · Performance work in .NET means removing allocations from your code. One technique is to change critical data structures from `class` to `struct`. That changes semantics and means more data is being copied. Learn how to minimize allocations while preserving semantics and avoid extra copies.

  3. Apr 19, 2017 · ASP.NET Core applications can be tested with different testing frameworks and Entity Framework Core makes testing specially easy by removing different technical problems from our way by using in-memory data provider. This blog posts shows how to unit test controllers that use data from Entity Framework Core. NB!

  4. Jan 8, 2024 · A quick, practical tutorial on setting up an in-memory database for running self-contained persistence-layer tests in a Spring application.

  5. Nov 22, 2022 · Tutorial built with .NET 6.0. This post shows how to connect a .NET 6 API to an InMemory database for testing with Entity Framework Core. The example code is from of a .NET 6 CRUD API tutorial I posted recently that uses the EF Core InMemory db provider.

  6. Feb 3, 2021 · How to create an immutable collection of cache objects and how to unit test IMemoryCache

  1. People also search for