mishrsud / dotmemory-demos

This repository contains a demo application that can be used to demonstrate JetBrains dotMemory and dotMemory Unit.

Home Page:http://www.jetbrains.com/dotmemory

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

internal JetBrains project

DotMemory Demos

This repository contains a demo application that can be used to demonstrate JetBrains dotMemory and dotMemory Unit.

The demo application contains various memory issues, such as memory leaks, high memory traffic and so on. It is used in various screencasts available from our documentation.

Demo application

The demo application is an implementation of Conway's Game of Life, where we can experiment with structures that evolve through generations.

Game of Life in action

The solution file contains two projects:

  • GameOfLife - The Game of Life implementation, featuring various memory issues.
  • Tests - Unit tests that use dotMemory Unit to validate memory behaviour.

Profiling

The Game of Life can be profiled using dotMemory, with various settings (such as collecting allocations or not).

dotMemory collecting snapshots

There are various issues to be uncovered. Some are easy to find using dotMemory's automatic inspections, while others require a bit more investigation.

Unit testing

Discovering memory issues is one thing, making sure the will not occur again is another. The tests project contains various unit tests that make use of dotMemory Unit and replay profiling sessions in code. These tests will fail when run, as the memory leaks are still in the code base. Throughout the code, there are also comments that help resolve the memory issues.

For example, this test verifies the amount of memory allocated during execution:

[Test]
[AssertTraffic(AllocatedSizeInBytes = 2*Mb)] // --assert
public void WholeRunTraffic()
{
    // --act
    var target = new PetriDish(160, 100, timer);

    for (var i = 0; i < 100; i++)
        target.PerformOneStep();
}

Searching for WholeRunTraffic will pinpoint the location of the test failure and provide a hint for fixing it.

About

This repository contains a demo application that can be used to demonstrate JetBrains dotMemory and dotMemory Unit.

http://www.jetbrains.com/dotmemory


Languages

Language:C# 100.0%