SlideShare ist ein Scribd-Unternehmen logo
1 von 60
Downloaden Sie, um offline zu lesen
Game Programming
Debugging & Performance Optimization
Nick Prühs
Objectives
• To get an overview of techniques for preventing bugs beforehand
• To learn how to track down and properly remove bugs from your
code
• To understand possible performance bottlenecks
2 / 55
Why you should always start debugging immediately
• Code entropy says your code will get worse, all the time, unless you
actively invest in preventing that
• Broken windows theory says the worse your code is, the worse it will
become
• Tracking down bugs is harder in a larger code base
• Tracking down bugs is harder in a buggy code base
3 / 55
Code Quality Tools
4 / 55
Code Quality Tools
5 / 55
Code Quality Tools
6 / 55
/// <summary>
/// Attaches the passed component to the entity with the specified id.
/// Note that this manager does not check whether the specified id is valid.
/// </summary>
/// <exception cref="ArgumentNullException">
/// Passed component is null.
/// </exception>
/// <exception cref="InvalidOperationException">
/// There is already a component of the same type attached.
/// </exception>
public void AddComponent(int entityId, IEntityComponent component)
{
if (component == null)
{
throw new ArgumentNullException("component");
}
if (this.components.ContainsKey(entityId))
{
throw new InvalidOperationException(
"There is already a component of type " + component.GetType() + " attached to entity with id "
+ entityId + ".");
}
this.components.Add(entityId, component);
this.OnComponentAdded(entityId, component);
}
You need a repro. Period.
How can you be sure you’ve fixed it?
7 / 55
Stack Traces
Object reference not set to an instance of an object
at LifeApplication.Initializer.CreateManagers () [0x00488] in
Initializer.cs:481
at LifeApplication.Initializer.OnLoad () [0x00016] in
Initializer.cs:235
8 / 55
What’s null here?
// Initialize progress manager.
var progressConfig = new ProgressConfig(this.unityLoader.Version.Code);
if (this.config.Progress.Encrypt)
{
progressConfig.SetEncryption(
this.config.Progress.Encryption.EncryptKey,
this.config.Progress.Encryption.EncryptIv);
}
9 / 55
What’s null here?
// Initialize progress manager.
var progressConfig = new ProgressConfig(this.unityLoader.Version.Code);
if (this.config.Progress.Encrypt)
{
progressConfig.SetEncryption(
this.config.Progress.Encryption.EncryptKey,
this.config.Progress.Encryption.EncryptIv);
}
10 / 55
What’s null here?
// Initialize progress manager.
var progressConfig = new ProgressConfig(this.unityLoader.Version.Code);
if (this.config.Progress.Encrypt)
{
progressConfig.SetEncryption(
this.config.Progress.Encryption.EncryptKey,
this.config.Progress.Encryption.EncryptIv);
}
11 / 55
What’s null here?
// Initialize progress manager.
var progressConfig = new ProgressConfig(this.unityLoader.Version.Code);
if (this.config.Progress.Encrypt)
{
progressConfig.SetEncryption(
this.config.Progress.Encryption.EncryptKey,
this.config.Progress.Encryption.EncryptIv);
}
12 / 55
What’s null here?
// Initialize progress manager.
var progressConfig = new ProgressConfig(this.unityLoader.Version.Code);
if (this.config.Progress.Encrypt)
{
progressConfig.SetEncryption(
this.config.Progress.Encryption.EncryptKey,
this.config.Progress.Encryption.EncryptIv);
}
13 / 55
What’s null here?
// Initialize progress manager.
var progressConfig = new ProgressConfig(this.unityLoader.Version.Code);
if (this.config.Progress.Encrypt)
{
progressConfig.SetEncryption(
this.config.Progress.Encryption.EncryptKey,
this.config.Progress.Encryption.EncryptIv);
}
14 / 55
Divide-and-conquer
15 / 55
Divide-and-conquer
16 / 55
Divide-and-conquer
17 / 55
Divide-and-conquer
18 / 55
Divide-and-conquer
19 / 55
Divide-and-conquer
20 / 55
Conditional Breakpoints
21 / 55
Logging
22 / 55
On-Screen
23 / 55
Crash Dump Analaysis
24 / 55
C:Program FilesProcdump>procdump.exe -ma -i D:TempDumps
ProcDump v7.0 - Writes process dump files
Copyright (C) 2009-2014 Mark Russinovich
Sysinternals - www.sysinternals.com
With contributions from Andrew Richards
Set to:
HKLMSOFTWAREMicrosoftWindows NTCurrentVersionAeDebug
(REG_SZ) Auto = 1
(REG_SZ) Debugger = "C:Program FilesProcdumpprocdump.exe" -accepteula -ma
-j "D:TempDumps" %ld %ld %p
Set to:
HKLMSOFTWAREWow6432NodeMicrosoftWindows NTCurrentVersionAeDebug
(REG_SZ) Auto = 1
(REG_SZ) Debugger = "C:Program FilesProcdumpprocdump.exe" -accepteula -ma
-j "D:TempDumps" %ld %ld %p
ProcDump is now set as the Just-in-time (AeDebug) debugger.
Crash Dump Analaysis
25 / 55
C:Program FilesProcdump>procdump.exe -u
ProcDump v7.0 - Writes process dump files
Copyright (C) 2009-2014 Mark Russinovich
Sysinternals - www.sysinternals.com
With contributions from Andrew Richards
Reset to:
HKLMSOFTWAREMicrosoftWindows NTCurrentVersionAeDebug
(REG_SZ) Auto = <deleted>
(REG_SZ) Debugger = "C:WINDOWSsystem32vsjitdebugger.exe" -p %ld -e %ld
Reset to:
HKLMSOFTWAREWow6432NodeMicrosoftWindows NTCurrentVersionAeDebug
(REG_SZ) Auto = <deleted>
(REG_SZ) Debugger = "C:WINDOWSsystem32vsjitdebugger.exe" -p %ld -e %ld
ProcDump is no longer the Just-in-time (AeDebug) debugger.
Crash Dump Analaysis
26 / 55
Deferencing a nullptr that will cause a crash
Crash Dump Analaysis
27 / 55
Minidump File Summary in Visual Studio
Crash Dump Analaysis
28 / 55
Debugging a Minidump in Visual Studio
Pair Programming
29 / 55
Source: University of Utah, UIT
And if nothings helps …
30 / 55
And if nothings helps …
31 / 55
TRY AGAIN
TOMORROW!
Some are really nasty …
• Remote systems
• Race conditions
• Mobile development, embedded systems, drivers
• “Release Mode only” bugs
32 / 55
Quoting My Tutor
“If the bug is not where you expect it to be,
you better start looking for it where you’re not expecting it to be.”
- Hagen Peters
33 / 55
Why you should never start optimizing immediately
• Your code base will change over time, a lot, most likely removing
some of the code you’ve spent time on optimizing
• Optimized code tends to be hard to read
▪ … and thus, hard to debug.
34 / 55
Performance Optimization
1. Profile first!
35 / 55
Performance Optimization
1. Profile first!
2. Profile again!
36 / 55
Performance Optimization
1. Profile first!
2. Profile again!
3. Identify the bottlenecks: GPU vs. CPU vs. Memory
37 / 55
38 / 55
GPU Bottleneck
39 / 55
Frame Debugger
40 / 55
Frame Debugger
41 / 55
Frame Debugger
42 / 55
Frame Debugger
43 / 55
Frame Debugger
44 / 5
Fighting CPU Bottlenecks
Pooling
Trades memory for CPU performance.
Re-uses objects to prevent costly construction and destruction.
Requires proper (cheap) reset of pooled objects.
45 / 55
Fighting CPU Bottlenecks
Caching
Trades memory for CPU performance.
Stores computed values for later use.
Requires proper cache invalidation whenever the input changes.
46 / 55
Fighting CPU Bottlenecks
Bucketing
Trades accuracy for CPU performance.
Distributes computations across multiple frames by dividing operation
into multiple input sets.
Can only be applied if player doesn’t notice difference immediately (e.g.
updating AI just twice per second).
47 / 55
Memory Bottleneck
48 / 55
Memory Bottleneck
49 / 55
Memory Bottleneck
50 / 55
Gotcha!
Always turn off logging before
profiling!
Otherwise, disk I/O will lead to
false results.
51 / 55
Hint
If no native profiling tools are
available (or applicable), you can
always fall back to utility classes
such as
System.Diagnostics.Stopwatch.
52 / 55
Memory Leaks
• allocated memory that is never released
▪ in most cases, the reference or pointer is not even available any
more
▪ if occurring on a regular basis (e.g. every time a level is loaded),
will eventually fill up all available memory and crash the game
• in Ansi C: “no malloc without free”
• in C++: “no new without delete”
▪ in modern C++, usually achieved by the means of smart pointers
Gotcha!
Managed runtime
environments can leak
memory, too!
54 / 55
Memory Leaks
• make sure to always remove all registered event handlers in
languages like C#
• more complicated runtime environments can represent unique
challenges
▪ e.g. Mono heap in Unity
• it might be a good idea to return to an “empty scene” once in a while
and verify all memory has been properly cleaned up
Memory Leak in Unity
Memory Leak in Unity
References
• McShaffry. Debugging Your Game … or “That’s not supposed to
happen!”. Austin Game Conference, 2003.
58 / 55
Thank you!
http://www.npruehs.de
https://github.com/npruehs
@npruehs
nick.pruehs@daedalic.com
5 Minute Review Session
• Why should you always start debugging immediately?
• Why should you never start optimizing immediately?
• Name a few tools and approaches for tracking down broken code!
• How do you know whether you’ve got an GPU, CPU or memory
bottleneck?
• Name a few techniques for fighting CPU bottlenecks!

Weitere ähnliche Inhalte

Was ist angesagt?

School For Games 2015 - Unity Engine Basics
School For Games 2015 - Unity Engine BasicsSchool For Games 2015 - Unity Engine Basics
School For Games 2015 - Unity Engine BasicsNick Pruehs
 
Style & Design Principles 03 - Component-Based Entity Systems
Style & Design Principles 03 - Component-Based Entity SystemsStyle & Design Principles 03 - Component-Based Entity Systems
Style & Design Principles 03 - Component-Based Entity SystemsNick Pruehs
 
Game Programming 01 - Introduction
Game Programming 01 - IntroductionGame Programming 01 - Introduction
Game Programming 01 - IntroductionNick Pruehs
 
Game Programming 08 - Tool Development
Game Programming 08 - Tool DevelopmentGame Programming 08 - Tool Development
Game Programming 08 - Tool DevelopmentNick Pruehs
 
Game Programming 09 - AI
Game Programming 09 - AIGame Programming 09 - AI
Game Programming 09 - AINick Pruehs
 
Game Programming 04 - Style & Design Principles
Game Programming 04 - Style & Design PrinciplesGame Programming 04 - Style & Design Principles
Game Programming 04 - Style & Design PrinciplesNick Pruehs
 
Game Programming 02 - Component-Based Entity Systems
Game Programming 02 - Component-Based Entity SystemsGame Programming 02 - Component-Based Entity Systems
Game Programming 02 - Component-Based Entity SystemsNick Pruehs
 
Quality Assurance 1: Why Quality Matters
Quality Assurance 1: Why Quality MattersQuality Assurance 1: Why Quality Matters
Quality Assurance 1: Why Quality MattersMarc Miquel
 
Entity Component Systems
Entity Component SystemsEntity Component Systems
Entity Component SystemsYos Riady
 
Y1 gd engine_terminology ig2 game engines
Y1 gd engine_terminology ig2 game enginesY1 gd engine_terminology ig2 game engines
Y1 gd engine_terminology ig2 game enginesLewis Brierley
 
Y1 gd engine_terminology ig2 game engines
Y1 gd engine_terminology ig2 game enginesY1 gd engine_terminology ig2 game engines
Y1 gd engine_terminology ig2 game enginesLewis Brierley
 
Containerize your Blackbox tests
Containerize your Blackbox testsContainerize your Blackbox tests
Containerize your Blackbox testsKevin Beeman
 
Y1 gd engine_terminologY
Y1 gd engine_terminologYY1 gd engine_terminologY
Y1 gd engine_terminologYElliotBlack
 
Owning windows 8 with human interface devices
Owning windows 8 with human interface devicesOwning windows 8 with human interface devices
Owning windows 8 with human interface devicesNikhil Mittal
 
Alexandre Iline Rit 2010 Java Fxui
Alexandre Iline Rit 2010 Java FxuiAlexandre Iline Rit 2010 Java Fxui
Alexandre Iline Rit 2010 Java Fxuirit2010
 
Crash wars - The handling awakens v3.0
Crash wars - The handling awakens v3.0Crash wars - The handling awakens v3.0
Crash wars - The handling awakens v3.0Željko Plesac
 
Rapid prototyping with ScriptableObjects
Rapid prototyping with ScriptableObjectsRapid prototyping with ScriptableObjects
Rapid prototyping with ScriptableObjectsGiorgio Pomettini
 
Maximize Your Production Effort (English)
Maximize Your Production Effort (English)Maximize Your Production Effort (English)
Maximize Your Production Effort (English)slantsixgames
 

Was ist angesagt? (19)

School For Games 2015 - Unity Engine Basics
School For Games 2015 - Unity Engine BasicsSchool For Games 2015 - Unity Engine Basics
School For Games 2015 - Unity Engine Basics
 
Style & Design Principles 03 - Component-Based Entity Systems
Style & Design Principles 03 - Component-Based Entity SystemsStyle & Design Principles 03 - Component-Based Entity Systems
Style & Design Principles 03 - Component-Based Entity Systems
 
AAA Automated Testing
AAA Automated TestingAAA Automated Testing
AAA Automated Testing
 
Game Programming 01 - Introduction
Game Programming 01 - IntroductionGame Programming 01 - Introduction
Game Programming 01 - Introduction
 
Game Programming 08 - Tool Development
Game Programming 08 - Tool DevelopmentGame Programming 08 - Tool Development
Game Programming 08 - Tool Development
 
Game Programming 09 - AI
Game Programming 09 - AIGame Programming 09 - AI
Game Programming 09 - AI
 
Game Programming 04 - Style & Design Principles
Game Programming 04 - Style & Design PrinciplesGame Programming 04 - Style & Design Principles
Game Programming 04 - Style & Design Principles
 
Game Programming 02 - Component-Based Entity Systems
Game Programming 02 - Component-Based Entity SystemsGame Programming 02 - Component-Based Entity Systems
Game Programming 02 - Component-Based Entity Systems
 
Quality Assurance 1: Why Quality Matters
Quality Assurance 1: Why Quality MattersQuality Assurance 1: Why Quality Matters
Quality Assurance 1: Why Quality Matters
 
Entity Component Systems
Entity Component SystemsEntity Component Systems
Entity Component Systems
 
Y1 gd engine_terminology ig2 game engines
Y1 gd engine_terminology ig2 game enginesY1 gd engine_terminology ig2 game engines
Y1 gd engine_terminology ig2 game engines
 
Y1 gd engine_terminology ig2 game engines
Y1 gd engine_terminology ig2 game enginesY1 gd engine_terminology ig2 game engines
Y1 gd engine_terminology ig2 game engines
 
Containerize your Blackbox tests
Containerize your Blackbox testsContainerize your Blackbox tests
Containerize your Blackbox tests
 
Y1 gd engine_terminologY
Y1 gd engine_terminologYY1 gd engine_terminologY
Y1 gd engine_terminologY
 
Owning windows 8 with human interface devices
Owning windows 8 with human interface devicesOwning windows 8 with human interface devices
Owning windows 8 with human interface devices
 
Alexandre Iline Rit 2010 Java Fxui
Alexandre Iline Rit 2010 Java FxuiAlexandre Iline Rit 2010 Java Fxui
Alexandre Iline Rit 2010 Java Fxui
 
Crash wars - The handling awakens v3.0
Crash wars - The handling awakens v3.0Crash wars - The handling awakens v3.0
Crash wars - The handling awakens v3.0
 
Rapid prototyping with ScriptableObjects
Rapid prototyping with ScriptableObjectsRapid prototyping with ScriptableObjects
Rapid prototyping with ScriptableObjects
 
Maximize Your Production Effort (English)
Maximize Your Production Effort (English)Maximize Your Production Effort (English)
Maximize Your Production Effort (English)
 

Andere mochten auch

Game Programming 10 - Localization
Game Programming 10 - LocalizationGame Programming 10 - Localization
Game Programming 10 - LocalizationNick Pruehs
 
Game Programming 03 - Git Flow
Game Programming 03 - Git FlowGame Programming 03 - Git Flow
Game Programming 03 - Git FlowNick Pruehs
 
Component-Based Entity Systems (Demo)
Component-Based Entity Systems (Demo)Component-Based Entity Systems (Demo)
Component-Based Entity Systems (Demo)Nick Pruehs
 
Tool Development A - Git
Tool Development A - GitTool Development A - Git
Tool Development A - GitNick Pruehs
 
Game Programming 11 - Game Physics
Game Programming 11 - Game PhysicsGame Programming 11 - Game Physics
Game Programming 11 - Game PhysicsNick Pruehs
 
Game Models - A Different Approach
Game Models - A Different ApproachGame Models - A Different Approach
Game Models - A Different ApproachNick Pruehs
 
Designing an actor model game architecture with Pony
Designing an actor model game architecture with PonyDesigning an actor model game architecture with Pony
Designing an actor model game architecture with PonyNick Pruehs
 
Entity System Architecture with Unity - Unite Europe 2015
Entity System Architecture with Unity - Unite Europe 2015Entity System Architecture with Unity - Unite Europe 2015
Entity System Architecture with Unity - Unite Europe 2015Simon Schmid
 
ECS architecture with Unity by example - Unite Europe 2016
ECS architecture with Unity by example - Unite Europe 2016ECS architecture with Unity by example - Unite Europe 2016
ECS architecture with Unity by example - Unite Europe 2016Simon Schmid
 
Clean, fast and simple with Entitas and Unity - Unite Melbourne 2016
Clean, fast and simple with Entitas and Unity - Unite Melbourne 2016Clean, fast and simple with Entitas and Unity - Unite Melbourne 2016
Clean, fast and simple with Entitas and Unity - Unite Melbourne 2016Simon Schmid
 

Andere mochten auch (10)

Game Programming 10 - Localization
Game Programming 10 - LocalizationGame Programming 10 - Localization
Game Programming 10 - Localization
 
Game Programming 03 - Git Flow
Game Programming 03 - Git FlowGame Programming 03 - Git Flow
Game Programming 03 - Git Flow
 
Component-Based Entity Systems (Demo)
Component-Based Entity Systems (Demo)Component-Based Entity Systems (Demo)
Component-Based Entity Systems (Demo)
 
Tool Development A - Git
Tool Development A - GitTool Development A - Git
Tool Development A - Git
 
Game Programming 11 - Game Physics
Game Programming 11 - Game PhysicsGame Programming 11 - Game Physics
Game Programming 11 - Game Physics
 
Game Models - A Different Approach
Game Models - A Different ApproachGame Models - A Different Approach
Game Models - A Different Approach
 
Designing an actor model game architecture with Pony
Designing an actor model game architecture with PonyDesigning an actor model game architecture with Pony
Designing an actor model game architecture with Pony
 
Entity System Architecture with Unity - Unite Europe 2015
Entity System Architecture with Unity - Unite Europe 2015Entity System Architecture with Unity - Unite Europe 2015
Entity System Architecture with Unity - Unite Europe 2015
 
ECS architecture with Unity by example - Unite Europe 2016
ECS architecture with Unity by example - Unite Europe 2016ECS architecture with Unity by example - Unite Europe 2016
ECS architecture with Unity by example - Unite Europe 2016
 
Clean, fast and simple with Entitas and Unity - Unite Melbourne 2016
Clean, fast and simple with Entitas and Unity - Unite Melbourne 2016Clean, fast and simple with Entitas and Unity - Unite Melbourne 2016
Clean, fast and simple with Entitas and Unity - Unite Melbourne 2016
 

Ähnlich wie Game Programming 13 - Debugging & Performance Optimization

No locked doors, no windows barred: hacking OpenAM infrastructure
No locked doors, no windows barred: hacking OpenAM infrastructureNo locked doors, no windows barred: hacking OpenAM infrastructure
No locked doors, no windows barred: hacking OpenAM infrastructureAndrew Petukhov
 
Exceptions in Java
Exceptions in JavaExceptions in Java
Exceptions in JavaVadym Lotar
 
Ceph Day Melbourne - Troubleshooting Ceph
Ceph Day Melbourne - Troubleshooting Ceph Ceph Day Melbourne - Troubleshooting Ceph
Ceph Day Melbourne - Troubleshooting Ceph Ceph Community
 
How many ways to monitor oracle golden gate-Collaborate 14
How many ways to monitor oracle golden gate-Collaborate 14How many ways to monitor oracle golden gate-Collaborate 14
How many ways to monitor oracle golden gate-Collaborate 14Bobby Curtis
 
Don't Suck at Building Stuff - Mykel Alvis at Puppet Camp Altanta
Don't Suck at Building Stuff  - Mykel Alvis at Puppet Camp AltantaDon't Suck at Building Stuff  - Mykel Alvis at Puppet Camp Altanta
Don't Suck at Building Stuff - Mykel Alvis at Puppet Camp AltantaPuppet
 
Deploying software at Scale
Deploying software at ScaleDeploying software at Scale
Deploying software at ScaleKris Buytaert
 
Why Software Test Performance Matters
Why Software Test Performance MattersWhy Software Test Performance Matters
Why Software Test Performance MattersSolano Labs
 
Continuous Integration In Php
Continuous Integration In PhpContinuous Integration In Php
Continuous Integration In PhpWilco Jansen
 
Code quality par Simone Civetta
Code quality par Simone CivettaCode quality par Simone Civetta
Code quality par Simone CivettaCocoaHeads France
 
High Reliabilty Systems
High Reliabilty SystemsHigh Reliabilty Systems
High Reliabilty SystemsLloydMoore
 
The Final Frontier, Automating Dynamic Security Testing
The Final Frontier, Automating Dynamic Security TestingThe Final Frontier, Automating Dynamic Security Testing
The Final Frontier, Automating Dynamic Security TestingMatt Tesauro
 
CNIT 126 8: Debugging
CNIT 126 8: DebuggingCNIT 126 8: Debugging
CNIT 126 8: DebuggingSam Bowne
 
Ansible for Configuration Management for Lohika DevOps training 2018 @ Lohika...
Ansible for Configuration Management for Lohika DevOps training 2018 @ Lohika...Ansible for Configuration Management for Lohika DevOps training 2018 @ Lohika...
Ansible for Configuration Management for Lohika DevOps training 2018 @ Lohika...Ihor Banadiga
 
Head first android apps dev tools
Head first android apps dev toolsHead first android apps dev tools
Head first android apps dev toolsShaka Huang
 
CNIT 126: 8: Debugging
CNIT 126: 8: DebuggingCNIT 126: 8: Debugging
CNIT 126: 8: DebuggingSam Bowne
 
Writing Tests with the Unity Test Framework
Writing Tests with the Unity Test FrameworkWriting Tests with the Unity Test Framework
Writing Tests with the Unity Test FrameworkPeter Kofler
 
Dev and Ops Collaboration and Awareness at Etsy and Flickr
Dev and Ops Collaboration and Awareness at Etsy and FlickrDev and Ops Collaboration and Awareness at Etsy and Flickr
Dev and Ops Collaboration and Awareness at Etsy and FlickrJohn Allspaw
 
A lean automation blueprint for testing in continuous delivery
A lean automation blueprint for testing in continuous deliveryA lean automation blueprint for testing in continuous delivery
A lean automation blueprint for testing in continuous deliverySauce Labs
 

Ähnlich wie Game Programming 13 - Debugging & Performance Optimization (20)

Spaghetti gate
Spaghetti gateSpaghetti gate
Spaghetti gate
 
No locked doors, no windows barred: hacking OpenAM infrastructure
No locked doors, no windows barred: hacking OpenAM infrastructureNo locked doors, no windows barred: hacking OpenAM infrastructure
No locked doors, no windows barred: hacking OpenAM infrastructure
 
Exceptions in Java
Exceptions in JavaExceptions in Java
Exceptions in Java
 
Ceph Day Melbourne - Troubleshooting Ceph
Ceph Day Melbourne - Troubleshooting Ceph Ceph Day Melbourne - Troubleshooting Ceph
Ceph Day Melbourne - Troubleshooting Ceph
 
How many ways to monitor oracle golden gate-Collaborate 14
How many ways to monitor oracle golden gate-Collaborate 14How many ways to monitor oracle golden gate-Collaborate 14
How many ways to monitor oracle golden gate-Collaborate 14
 
Don't Suck at Building Stuff - Mykel Alvis at Puppet Camp Altanta
Don't Suck at Building Stuff  - Mykel Alvis at Puppet Camp AltantaDon't Suck at Building Stuff  - Mykel Alvis at Puppet Camp Altanta
Don't Suck at Building Stuff - Mykel Alvis at Puppet Camp Altanta
 
Exception handling
Exception handlingException handling
Exception handling
 
Deploying software at Scale
Deploying software at ScaleDeploying software at Scale
Deploying software at Scale
 
Why Software Test Performance Matters
Why Software Test Performance MattersWhy Software Test Performance Matters
Why Software Test Performance Matters
 
Continuous Integration In Php
Continuous Integration In PhpContinuous Integration In Php
Continuous Integration In Php
 
Code quality par Simone Civetta
Code quality par Simone CivettaCode quality par Simone Civetta
Code quality par Simone Civetta
 
High Reliabilty Systems
High Reliabilty SystemsHigh Reliabilty Systems
High Reliabilty Systems
 
The Final Frontier, Automating Dynamic Security Testing
The Final Frontier, Automating Dynamic Security TestingThe Final Frontier, Automating Dynamic Security Testing
The Final Frontier, Automating Dynamic Security Testing
 
CNIT 126 8: Debugging
CNIT 126 8: DebuggingCNIT 126 8: Debugging
CNIT 126 8: Debugging
 
Ansible for Configuration Management for Lohika DevOps training 2018 @ Lohika...
Ansible for Configuration Management for Lohika DevOps training 2018 @ Lohika...Ansible for Configuration Management for Lohika DevOps training 2018 @ Lohika...
Ansible for Configuration Management for Lohika DevOps training 2018 @ Lohika...
 
Head first android apps dev tools
Head first android apps dev toolsHead first android apps dev tools
Head first android apps dev tools
 
CNIT 126: 8: Debugging
CNIT 126: 8: DebuggingCNIT 126: 8: Debugging
CNIT 126: 8: Debugging
 
Writing Tests with the Unity Test Framework
Writing Tests with the Unity Test FrameworkWriting Tests with the Unity Test Framework
Writing Tests with the Unity Test Framework
 
Dev and Ops Collaboration and Awareness at Etsy and Flickr
Dev and Ops Collaboration and Awareness at Etsy and FlickrDev and Ops Collaboration and Awareness at Etsy and Flickr
Dev and Ops Collaboration and Awareness at Etsy and Flickr
 
A lean automation blueprint for testing in continuous delivery
A lean automation blueprint for testing in continuous deliveryA lean automation blueprint for testing in continuous delivery
A lean automation blueprint for testing in continuous delivery
 

Mehr von Nick Pruehs

Unreal Engine Basics 06 - Animation, Audio, Visual Effects
Unreal Engine Basics 06 - Animation, Audio, Visual EffectsUnreal Engine Basics 06 - Animation, Audio, Visual Effects
Unreal Engine Basics 06 - Animation, Audio, Visual EffectsNick Pruehs
 
Unreal Engine Basics 05 - User Interface
Unreal Engine Basics 05 - User InterfaceUnreal Engine Basics 05 - User Interface
Unreal Engine Basics 05 - User InterfaceNick Pruehs
 
Unreal Engine Basics 04 - Behavior Trees
Unreal Engine Basics 04 - Behavior TreesUnreal Engine Basics 04 - Behavior Trees
Unreal Engine Basics 04 - Behavior TreesNick Pruehs
 
Unreal Engine Basics 03 - Gameplay
Unreal Engine Basics 03 - GameplayUnreal Engine Basics 03 - Gameplay
Unreal Engine Basics 03 - GameplayNick Pruehs
 
Unreal Engine Basics 02 - Unreal Editor
Unreal Engine Basics 02 - Unreal EditorUnreal Engine Basics 02 - Unreal Editor
Unreal Engine Basics 02 - Unreal EditorNick Pruehs
 
Unreal Engine Basics 01 - Game Framework
Unreal Engine Basics 01 - Game FrameworkUnreal Engine Basics 01 - Game Framework
Unreal Engine Basics 01 - Game FrameworkNick Pruehs
 
Game Programming - Cloud Development
Game Programming - Cloud DevelopmentGame Programming - Cloud Development
Game Programming - Cloud DevelopmentNick Pruehs
 
Game Programming - Git
Game Programming - GitGame Programming - Git
Game Programming - GitNick Pruehs
 
Game Programming 00 - Exams
Game Programming 00 - ExamsGame Programming 00 - Exams
Game Programming 00 - ExamsNick Pruehs
 
Tool Development 10 - MVVM, Tool Chains
Tool Development 10 - MVVM, Tool ChainsTool Development 10 - MVVM, Tool Chains
Tool Development 10 - MVVM, Tool ChainsNick Pruehs
 

Mehr von Nick Pruehs (10)

Unreal Engine Basics 06 - Animation, Audio, Visual Effects
Unreal Engine Basics 06 - Animation, Audio, Visual EffectsUnreal Engine Basics 06 - Animation, Audio, Visual Effects
Unreal Engine Basics 06 - Animation, Audio, Visual Effects
 
Unreal Engine Basics 05 - User Interface
Unreal Engine Basics 05 - User InterfaceUnreal Engine Basics 05 - User Interface
Unreal Engine Basics 05 - User Interface
 
Unreal Engine Basics 04 - Behavior Trees
Unreal Engine Basics 04 - Behavior TreesUnreal Engine Basics 04 - Behavior Trees
Unreal Engine Basics 04 - Behavior Trees
 
Unreal Engine Basics 03 - Gameplay
Unreal Engine Basics 03 - GameplayUnreal Engine Basics 03 - Gameplay
Unreal Engine Basics 03 - Gameplay
 
Unreal Engine Basics 02 - Unreal Editor
Unreal Engine Basics 02 - Unreal EditorUnreal Engine Basics 02 - Unreal Editor
Unreal Engine Basics 02 - Unreal Editor
 
Unreal Engine Basics 01 - Game Framework
Unreal Engine Basics 01 - Game FrameworkUnreal Engine Basics 01 - Game Framework
Unreal Engine Basics 01 - Game Framework
 
Game Programming - Cloud Development
Game Programming - Cloud DevelopmentGame Programming - Cloud Development
Game Programming - Cloud Development
 
Game Programming - Git
Game Programming - GitGame Programming - Git
Game Programming - Git
 
Game Programming 00 - Exams
Game Programming 00 - ExamsGame Programming 00 - Exams
Game Programming 00 - Exams
 
Tool Development 10 - MVVM, Tool Chains
Tool Development 10 - MVVM, Tool ChainsTool Development 10 - MVVM, Tool Chains
Tool Development 10 - MVVM, Tool Chains
 

Kürzlich hochgeladen

Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGSujit Pal
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 

Kürzlich hochgeladen (20)

Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAG
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 

Game Programming 13 - Debugging & Performance Optimization

  • 1. Game Programming Debugging & Performance Optimization Nick Prühs
  • 2. Objectives • To get an overview of techniques for preventing bugs beforehand • To learn how to track down and properly remove bugs from your code • To understand possible performance bottlenecks 2 / 55
  • 3. Why you should always start debugging immediately • Code entropy says your code will get worse, all the time, unless you actively invest in preventing that • Broken windows theory says the worse your code is, the worse it will become • Tracking down bugs is harder in a larger code base • Tracking down bugs is harder in a buggy code base 3 / 55
  • 6. Code Quality Tools 6 / 55 /// <summary> /// Attaches the passed component to the entity with the specified id. /// Note that this manager does not check whether the specified id is valid. /// </summary> /// <exception cref="ArgumentNullException"> /// Passed component is null. /// </exception> /// <exception cref="InvalidOperationException"> /// There is already a component of the same type attached. /// </exception> public void AddComponent(int entityId, IEntityComponent component) { if (component == null) { throw new ArgumentNullException("component"); } if (this.components.ContainsKey(entityId)) { throw new InvalidOperationException( "There is already a component of type " + component.GetType() + " attached to entity with id " + entityId + "."); } this.components.Add(entityId, component); this.OnComponentAdded(entityId, component); }
  • 7. You need a repro. Period. How can you be sure you’ve fixed it? 7 / 55
  • 8. Stack Traces Object reference not set to an instance of an object at LifeApplication.Initializer.CreateManagers () [0x00488] in Initializer.cs:481 at LifeApplication.Initializer.OnLoad () [0x00016] in Initializer.cs:235 8 / 55
  • 9. What’s null here? // Initialize progress manager. var progressConfig = new ProgressConfig(this.unityLoader.Version.Code); if (this.config.Progress.Encrypt) { progressConfig.SetEncryption( this.config.Progress.Encryption.EncryptKey, this.config.Progress.Encryption.EncryptIv); } 9 / 55
  • 10. What’s null here? // Initialize progress manager. var progressConfig = new ProgressConfig(this.unityLoader.Version.Code); if (this.config.Progress.Encrypt) { progressConfig.SetEncryption( this.config.Progress.Encryption.EncryptKey, this.config.Progress.Encryption.EncryptIv); } 10 / 55
  • 11. What’s null here? // Initialize progress manager. var progressConfig = new ProgressConfig(this.unityLoader.Version.Code); if (this.config.Progress.Encrypt) { progressConfig.SetEncryption( this.config.Progress.Encryption.EncryptKey, this.config.Progress.Encryption.EncryptIv); } 11 / 55
  • 12. What’s null here? // Initialize progress manager. var progressConfig = new ProgressConfig(this.unityLoader.Version.Code); if (this.config.Progress.Encrypt) { progressConfig.SetEncryption( this.config.Progress.Encryption.EncryptKey, this.config.Progress.Encryption.EncryptIv); } 12 / 55
  • 13. What’s null here? // Initialize progress manager. var progressConfig = new ProgressConfig(this.unityLoader.Version.Code); if (this.config.Progress.Encrypt) { progressConfig.SetEncryption( this.config.Progress.Encryption.EncryptKey, this.config.Progress.Encryption.EncryptIv); } 13 / 55
  • 14. What’s null here? // Initialize progress manager. var progressConfig = new ProgressConfig(this.unityLoader.Version.Code); if (this.config.Progress.Encrypt) { progressConfig.SetEncryption( this.config.Progress.Encryption.EncryptKey, this.config.Progress.Encryption.EncryptIv); } 14 / 55
  • 24. Crash Dump Analaysis 24 / 55 C:Program FilesProcdump>procdump.exe -ma -i D:TempDumps ProcDump v7.0 - Writes process dump files Copyright (C) 2009-2014 Mark Russinovich Sysinternals - www.sysinternals.com With contributions from Andrew Richards Set to: HKLMSOFTWAREMicrosoftWindows NTCurrentVersionAeDebug (REG_SZ) Auto = 1 (REG_SZ) Debugger = "C:Program FilesProcdumpprocdump.exe" -accepteula -ma -j "D:TempDumps" %ld %ld %p Set to: HKLMSOFTWAREWow6432NodeMicrosoftWindows NTCurrentVersionAeDebug (REG_SZ) Auto = 1 (REG_SZ) Debugger = "C:Program FilesProcdumpprocdump.exe" -accepteula -ma -j "D:TempDumps" %ld %ld %p ProcDump is now set as the Just-in-time (AeDebug) debugger.
  • 25. Crash Dump Analaysis 25 / 55 C:Program FilesProcdump>procdump.exe -u ProcDump v7.0 - Writes process dump files Copyright (C) 2009-2014 Mark Russinovich Sysinternals - www.sysinternals.com With contributions from Andrew Richards Reset to: HKLMSOFTWAREMicrosoftWindows NTCurrentVersionAeDebug (REG_SZ) Auto = <deleted> (REG_SZ) Debugger = "C:WINDOWSsystem32vsjitdebugger.exe" -p %ld -e %ld Reset to: HKLMSOFTWAREWow6432NodeMicrosoftWindows NTCurrentVersionAeDebug (REG_SZ) Auto = <deleted> (REG_SZ) Debugger = "C:WINDOWSsystem32vsjitdebugger.exe" -p %ld -e %ld ProcDump is no longer the Just-in-time (AeDebug) debugger.
  • 26. Crash Dump Analaysis 26 / 55 Deferencing a nullptr that will cause a crash
  • 27. Crash Dump Analaysis 27 / 55 Minidump File Summary in Visual Studio
  • 28. Crash Dump Analaysis 28 / 55 Debugging a Minidump in Visual Studio
  • 29. Pair Programming 29 / 55 Source: University of Utah, UIT
  • 30. And if nothings helps … 30 / 55
  • 31. And if nothings helps … 31 / 55 TRY AGAIN TOMORROW!
  • 32. Some are really nasty … • Remote systems • Race conditions • Mobile development, embedded systems, drivers • “Release Mode only” bugs 32 / 55
  • 33. Quoting My Tutor “If the bug is not where you expect it to be, you better start looking for it where you’re not expecting it to be.” - Hagen Peters 33 / 55
  • 34. Why you should never start optimizing immediately • Your code base will change over time, a lot, most likely removing some of the code you’ve spent time on optimizing • Optimized code tends to be hard to read ▪ … and thus, hard to debug. 34 / 55
  • 36. Performance Optimization 1. Profile first! 2. Profile again! 36 / 55
  • 37. Performance Optimization 1. Profile first! 2. Profile again! 3. Identify the bottlenecks: GPU vs. CPU vs. Memory 37 / 55
  • 45. Fighting CPU Bottlenecks Pooling Trades memory for CPU performance. Re-uses objects to prevent costly construction and destruction. Requires proper (cheap) reset of pooled objects. 45 / 55
  • 46. Fighting CPU Bottlenecks Caching Trades memory for CPU performance. Stores computed values for later use. Requires proper cache invalidation whenever the input changes. 46 / 55
  • 47. Fighting CPU Bottlenecks Bucketing Trades accuracy for CPU performance. Distributes computations across multiple frames by dividing operation into multiple input sets. Can only be applied if player doesn’t notice difference immediately (e.g. updating AI just twice per second). 47 / 55
  • 51. Gotcha! Always turn off logging before profiling! Otherwise, disk I/O will lead to false results. 51 / 55
  • 52. Hint If no native profiling tools are available (or applicable), you can always fall back to utility classes such as System.Diagnostics.Stopwatch. 52 / 55
  • 53. Memory Leaks • allocated memory that is never released ▪ in most cases, the reference or pointer is not even available any more ▪ if occurring on a regular basis (e.g. every time a level is loaded), will eventually fill up all available memory and crash the game • in Ansi C: “no malloc without free” • in C++: “no new without delete” ▪ in modern C++, usually achieved by the means of smart pointers
  • 54. Gotcha! Managed runtime environments can leak memory, too! 54 / 55
  • 55. Memory Leaks • make sure to always remove all registered event handlers in languages like C# • more complicated runtime environments can represent unique challenges ▪ e.g. Mono heap in Unity • it might be a good idea to return to an “empty scene” once in a while and verify all memory has been properly cleaned up
  • 56. Memory Leak in Unity
  • 57. Memory Leak in Unity
  • 58. References • McShaffry. Debugging Your Game … or “That’s not supposed to happen!”. Austin Game Conference, 2003. 58 / 55
  • 60. 5 Minute Review Session • Why should you always start debugging immediately? • Why should you never start optimizing immediately? • Name a few tools and approaches for tracking down broken code! • How do you know whether you’ve got an GPU, CPU or memory bottleneck? • Name a few techniques for fighting CPU bottlenecks!