This document discusses .NET memory management and the garbage collector. It explains that the CLR manages memory in a heap and the garbage collector reclaims unused memory. It describes how objects are allocated in generations and discusses how to help the garbage collector perform better by reducing allocations, using value types when possible, and properly disposing of objects. The document also provides examples of hidden allocations and demonstrates tools for analyzing memory usage like ClrMD and dotMemory Unit.
These days fast code needs to operate in harmony with its environment. At the deepest level this means working well with hardware: RAM, disks and SSDs. A unifying theme is treating memory access patterns in a uniform and predictable way that is sympathetic to the underlying hardware. For example writing to and reading from RAM and Hard Disks can be significantly sped up by operating sequentially on the device, rather than randomly accessing the data. In this talk we’ll cover why access patterns are important, what kind of speed gain you can get and how you can write simple high level code which works well with these kind of patterns.
This document provides an overview of big data analytics with Scala, including common frameworks and techniques. It discusses Lambda architecture, MapReduce, word counting examples, Scalding for batch and streaming jobs, Apache Storm, Trident, SummingBird for unified batch and streaming, and Apache Spark for fast cluster computing with resilient distributed datasets. It also covers clustering with Mahout, streaming word counting, and analytics platforms that combine batch and stream processing.
The document summarizes the D programming language compiler, including its organization with one front end and three back ends, major changes including converting the front end to D and using Dwarf exception handling. It describes the source code organization, types of compiles, memory allocation, strings, arrays, parsing, semantic analysis, lowering, constant folding, templates, inlining, and challenges in improving encapsulation, reducing complexity and memory usage.
This document provides an overview of object-oriented concepts in JavaScript. It defines JavaScript and its components like ECMAScript, DOM, and BOM. It discusses how JavaScript supports object-oriented programming features like polymorphism and inheritance through prototypal inheritance despite not being a classical OOP language. The document also covers JavaScript data types, objects, scope, closures, context, and methods for changing contexts like call and apply.
The document discusses garbage collection techniques used in Android, including mark-and-sweep, generational, and copying collection. It covers the goals of memory management in Android including minimizing app launch time and disk space usage. Key garbage collection algorithms described are mark-and-sweep, Cheney's copying algorithm, and concurrent mark-sweep.
This document discusses property-based testing using generators. It introduces the concept of generators and how they can be used to automatically generate random test inputs. The document outlines several key points:
- Generators can be composed together using operations like map, zip, and concat to produce complex generators from simple ones.
- Generators form algebraic structures like functors, monoids, and monads that allow them to be composed while satisfying certain mathematical laws.
- The generator library implements generators as classes with methods derived from these algebraic structures, allowing generators to be easily composed and transformed in a consistent way.
These days fast code needs to operate in harmony with its environment. At the deepest level this means working well with hardware: RAM, disks and SSDs. A unifying theme is treating memory access patterns in a uniform and predictable that is sympathetic to the underlying hardware. For example writing to and reading from RAM and Hard Disks can be significantly sped up by operating sequentially on the device, rather than randomly accessing the data.
In this talk we’ll cover why access patterns are important, what kind of speed gain you can get and how you can write simple high level code which works well with these kind of patterns.
This document provides an overview of Span<T> in .NET. It begins with background on memory management in .NET and value vs. reference types. It then defines Span<T> as a new value type that represents contiguous regions of memory, whether managed, unmanaged, or on the stack. It explains that Span<T> allows high-performance, low-overhead access to memory without unsafe code. Examples are given of using Span<T> to represent memory from arrays, strings, and other sources. Benchmarks show Span<T> outperforming alternatives like Substring. Real-world uses like parsing delimited strings are demonstrated.
This document discusses Scala and big data technologies. It provides an overview of Scala libraries for working with Hadoop and MapReduce, including Scalding which provides a Scala DSL for Cascading. It also covers Spark, a cluster computing framework that operates on distributed datasets in memory for faster performance. Additional Scala projects for data analysis using functional programming approaches on Hadoop are also mentioned.
Incremental Development with Lisp: Building a Game and a Website
I show how powerful incremental development with Lisp/Scheme is by showing a website and game I created by running the application and developing them real-time.
The document discusses key concepts related to memory management in the .NET CLR, including the heap and stack, value and reference types, pointers, and how objects are allocated in memory. It explains the garbage collection process, including different flavors, generations of objects, and pinning. Large object heap and finalization are also covered as it relates to unmanaged resources. Overall, the document provides a comprehensive overview of memory management in the .NET CLR.
This is second edition of my keynote "On Being a Professional Software Developer" with slide comments (in Russian) which contain main ideas of the keynote.
I hope the slides could be used as a standalone reading material.
Vibrant Technologies is headquarted in Mumbai,India.We are the best Hadoop training provider in Navi Mumbai who provides Live Projects to students.We provide Corporate Training also.We are Best Hadoop classes in Mumbai according to our students and corporates
This document provides an overview of garbage collection, including:
- The first language to use garbage collection was LISP in 1959.
- Garbage collection automatically manages memory allocation and deallocation.
- Key garbage collection methods are reference counting and tracing.
- Implementations include mark-and-sweep and copying collection.
- Modern garbage collectors use generational collection to more efficiently handle short-lived and long-lived objects.
Scalding is a Scala library built on top of Cascading that simplifies the process of defining MapReduce programs. It uses a functional programming approach where data flows are represented as chained transformations on TypedPipes, similar to operations on Scala iterators. This avoids some limitations of the traditional Hadoop MapReduce model by allowing for more flexible multi-step jobs and features like joins. The Scalding TypeSafe API also provides compile-time type safety compared to Cascading's runtime type checking.
1) Comparable and Comparator interfaces in Java can both be used to sort collections but have some key differences. Comparable provides a single sort order while Comparator allows multiple sort orders.
2) WritableComparable is a subinterface that extends both Writable and Comparable interfaces. Any type used as a key in Hadoop MapReduce must implement this interface.
3) RawComparator is an optimization Hadoop provides to directly compare byte arrays containing serialized objects instead of deserializing for comparison. WritableComparator implements RawComparator for WritableComparable types.
Quantifying the Performance of Garbage Collection vs. Explicit Memory Management
This talk answers an age-old question: is garbage collection faster/slower/the same speed as malloc/free? We introduce oracular memory management, an approach that lets us measure unaltered Java programs as if they used malloc and free. The result: a good GC can match the performance of a good allocator, but it takes 5X more space. If physical memory is tight, however, conventional garbage collectors suffer an order-of-magnitude performance penalty.
Exploring .NET memory management - A trip down memory lane - Copenhagen .NET ...
The .NET Garbage Collector (GC) is really cool. It helps providing our applications with virtually unlimited memory, so we can focus on writing code instead of manually freeing up memory. But how does .NET manage that memory? What are hidden allocations? Are strings evil? It still matters to understand when and where memory is allocated. In this talk, we’ll go over the base concepts of .NET memory management and explore how .NET helps us and how we can help .NET – making our apps better. Expect profiling, Intermediate Language (IL), ClrMD and more!
ConFoo - Exploring .NET’s memory management – a trip down memory lane
The .NET Garbage Collector (GC) is really cool. It helps providing our applications with virtually unlimited memory, so we can focus on writing code instead of manually freeing up memory. But how does .NET manage that memory? What are hidden allocations? Are strings evil? It still matters to understand when and where memory is allocated. In this talk, we’ll go over the base concepts of .NET memory management and explore how .NET helps us and how we can help .NET – making our apps better. Expect profiling, Intermediate Language (IL), ClrMD and more!
The .NET Garbage Collector (GC) is really cool. It helps providing our applications with virtually unlimited memory, so we can focus on writing code instead of manually freeing up memory. But how does .NET manage that memory? What are hidden allocations? Are strings evil? It still matters to understand when and where memory is allocated. In this talk, we’ll go over the base concepts of .NET memory management and explore how .NET helps us and how we can help .NET – making our apps better. Expect profiling, Intermediate Language (IL), ClrMD and more!
The .NET Garbage Collector (GC) is really cool. It helps providing our applications with virtually unlimited memory, so we can focus on writing code instead of manually freeing up memory. But how does .NET manage that memory? What are hidden allocations? Are strings evil? It still matters to understand when and where memory is allocated. In this talk, we’ll go over the base concepts of .NET memory management and explore how .NET helps us and how we can help .NET – making our apps better. Expect profiling, Intermediate Language (IL), ClrMD and more!
JetBrains Day Seoul - Exploring .NET’s memory management – a trip down memory...
The .NET Garbage Collector (GC) is really cool. It helps providing our applications with virtually unlimited memory, so we can focus on writing code instead of manually freeing up memory. But how does .NET manage that memory? What are hidden allocations? Are strings evil? It still matters to understand when and where memory is allocated. In this talk, we’ll go over the base concepts of .NET memory management and explore how .NET helps us and how we can help .NET – making our apps better. Expect profiling, Intermediate Language (IL), ClrMD and more!
This document discusses .NET systems programming and garbage collection. It covers garbage collection generations, modes, and considerations for minimizing allocations. It also discusses eliminating delegates to reduce allocations, using value types appropriately, avoiding empty collections, and optimizing for thread locality to reduce context switching overhead. Data structures and synchronization techniques are discussed, emphasizing the importance of choosing lock-free data structures when possible to improve performance.
This document provides an overview and agenda for the JPoint 2015 conference. It includes summaries of sessions on memory leaks profiling basics, notes about the Java String class, defining and measuring technical debt, how regular expressions work under the hood, and using memory dumps and analysis tools to find memory leaks. The agenda outlines sessions on memory regions, garbage collection, identifying memory leaks through examples, JVM options for logs and dumps, String class internals, technical debt concepts, and regular expression matching algorithms.
The document discusses memory management and garbage collection in the Hotspot Java Virtual Machine. It describes different garbage collection algorithms like mark-sweep, copying, and generational collection. It explains the different garbage collectors in Hotspot JVM like serial, parallel, parallel compacting, and concurrent mark sweep collectors. It also discusses some key garbage collection terminology and metrics.
The document outlines an advanced workshop on the EnScript programming language, covering topics such as language core concepts, syntax, object model, memory management, APIs, debugging, dialogs, handling evidence, external automation, conditions, reflection, and multithreading. The workshop agenda includes language fundamentals, basic APIs, debugging the execution environment, creating dialogs, handling evidence, external communication, conditions and reflection, and multithreading. Stewart also presents three fundamental laws of EnScript regarding data structures, memory management of NodeClass objects, and the relationship between EnScript classes and EnCase views.
The document discusses optimizing code and data for CPU caches through various techniques like improving data locality, reducing unnecessary memory accesses, and reusing cached data. It covers optimizing code layout, data structures, prefetching, and addressing issues like aliasing.
The document discusses various techniques for optimizing memory usage and cache performance in code. It begins by justifying the need for memory optimization given trends in CPU and memory speeds. It then provides an overview of memory hierarchies and caches. The rest of the document discusses specific techniques for optimizing data structures, prefetching, layout of data in memory, reducing aliasing, and other strategies to improve cache utilization and performance.
- C is a commonly used language for embedded systems due to its portability, efficiency, and conciseness. It was developed in the late 1960s and early 1970s alongside Unix.
- C was designed for systems programming tasks like operating systems and compilers. It was influenced by its predecessors BCPL and B and is well-suited for direct hardware manipulation.
- C uses expressions, conditional and iterative statements, functions, and other constructs to provide a structured and portable way to write low-level systems code while avoiding the complexity of assembly.
Kafka Streams: Revisiting the decisions of the past (How I could have made it...
Kafka Streams: Revisiting the decisions of the past (How I could have made it better), Jason Bell, Kafka DevOps Engineer @ Digitalis.io
https://www.meetup.com/Cleveland-Kafka/events/272339276/
Vector and ListBuffer have similar performance for random reads. Benchmarking showed no significant difference in throughput, average time, or sample times between reading randomly from a Vector versus a ListBuffer. Vectors are generally faster than Lists for random access due to Vectors being implemented as arrays under the hood.
This document discusses garbage collection techniques in Python. It begins by introducing the speaker's past presentations on Python debugging and code execution. It then covers reference counting, mark and sweep collection, and generational collection used in Python. It discusses advantages and disadvantages of different techniques. It also introduces the gc module interface in Python for controlling and debugging garbage collection.
The document discusses Java garbage collection. It explains that Java's garbage collector automatically manages memory by freeing unreferenced objects. The garbage collector runs when memory is low to find and delete objects that cannot be reached. While garbage collection provides convenience, it has overhead as the system must pause current execution to run it which can influence user experience. The document also describes how objects are identified as garbage using tracing and reference counting collectors as well as how to explicitly make objects available for collection and finalize objects before deletion.
These days fast code needs to operate in harmony with its environment. At the deepest level this means working well with hardware: RAM, disks and SSDs. A unifying theme is treating memory access patterns in a uniform and predictable way that is sympathetic to the underlying hardware. For example writing to and reading from RAM and Hard Disks can be significantly sped up by operating sequentially on the device, rather than randomly accessing the data. In this talk we’ll cover why access patterns are important, what kind of speed gain you can get and how you can write simple high level code which works well with these kind of patterns.
Big Data Analytics with Scala at SCALA.IO 2013Samir Bessalah
This document provides an overview of big data analytics with Scala, including common frameworks and techniques. It discusses Lambda architecture, MapReduce, word counting examples, Scalding for batch and streaming jobs, Apache Storm, Trident, SummingBird for unified batch and streaming, and Apache Spark for fast cluster computing with resilient distributed datasets. It also covers clustering with Mahout, streaming word counting, and analytics platforms that combine batch and stream processing.
The document summarizes the D programming language compiler, including its organization with one front end and three back ends, major changes including converting the front end to D and using Dwarf exception handling. It describes the source code organization, types of compiles, memory allocation, strings, arrays, parsing, semantic analysis, lowering, constant folding, templates, inlining, and challenges in improving encapsulation, reducing complexity and memory usage.
This document provides an overview of object-oriented concepts in JavaScript. It defines JavaScript and its components like ECMAScript, DOM, and BOM. It discusses how JavaScript supports object-oriented programming features like polymorphism and inheritance through prototypal inheritance despite not being a classical OOP language. The document also covers JavaScript data types, objects, scope, closures, context, and methods for changing contexts like call and apply.
The document discusses garbage collection techniques used in Android, including mark-and-sweep, generational, and copying collection. It covers the goals of memory management in Android including minimizing app launch time and disk space usage. Key garbage collection algorithms described are mark-and-sweep, Cheney's copying algorithm, and concurrent mark-sweep.
C++ Generators and Property-based TestingSumant Tambe
This document discusses property-based testing using generators. It introduces the concept of generators and how they can be used to automatically generate random test inputs. The document outlines several key points:
- Generators can be composed together using operations like map, zip, and concat to produce complex generators from simple ones.
- Generators form algebraic structures like functors, monoids, and monads that allow them to be composed while satisfying certain mathematical laws.
- The generator library implements generators as classes with methods derived from these algebraic structures, allowing generators to be easily composed and transformed in a consistent way.
These days fast code needs to operate in harmony with its environment. At the deepest level this means working well with hardware: RAM, disks and SSDs. A unifying theme is treating memory access patterns in a uniform and predictable that is sympathetic to the underlying hardware. For example writing to and reading from RAM and Hard Disks can be significantly sped up by operating sequentially on the device, rather than randomly accessing the data.
In this talk we’ll cover why access patterns are important, what kind of speed gain you can get and how you can write simple high level code which works well with these kind of patterns.
This document provides an overview of Span<T> in .NET. It begins with background on memory management in .NET and value vs. reference types. It then defines Span<T> as a new value type that represents contiguous regions of memory, whether managed, unmanaged, or on the stack. It explains that Span<T> allows high-performance, low-overhead access to memory without unsafe code. Examples are given of using Span<T> to represent memory from arrays, strings, and other sources. Benchmarks show Span<T> outperforming alternatives like Substring. Real-world uses like parsing delimited strings are demonstrated.
This document discusses Scala and big data technologies. It provides an overview of Scala libraries for working with Hadoop and MapReduce, including Scalding which provides a Scala DSL for Cascading. It also covers Spark, a cluster computing framework that operates on distributed datasets in memory for faster performance. Additional Scala projects for data analysis using functional programming approaches on Hadoop are also mentioned.
Incremental Development with Lisp: Building a Game and a WebsiteJames Long
I show how powerful incremental development with Lisp/Scheme is by showing a website and game I created by running the application and developing them real-time.
.NET UY Meetup 7 - CLR Memory by Fabian Alves.NET UY Meetup
The document discusses key concepts related to memory management in the .NET CLR, including the heap and stack, value and reference types, pointers, and how objects are allocated in memory. It explains the garbage collection process, including different flavors, generations of objects, and pinning. Large object heap and finalization are also covered as it relates to unmanaged resources. Overall, the document provides a comprehensive overview of memory management in the .NET CLR.
Evolving as a professional software developerAnton Kirillov
This is second edition of my keynote "On Being a Professional Software Developer" with slide comments (in Russian) which contain main ideas of the keynote.
I hope the slides could be used as a standalone reading material.
Vibrant Technologies is headquarted in Mumbai,India.We are the best Hadoop training provider in Navi Mumbai who provides Live Projects to students.We provide Corporate Training also.We are Best Hadoop classes in Mumbai according to our students and corporates
This document provides an overview of garbage collection, including:
- The first language to use garbage collection was LISP in 1959.
- Garbage collection automatically manages memory allocation and deallocation.
- Key garbage collection methods are reference counting and tracing.
- Implementations include mark-and-sweep and copying collection.
- Modern garbage collectors use generational collection to more efficiently handle short-lived and long-lived objects.
Scalding is a Scala library built on top of Cascading that simplifies the process of defining MapReduce programs. It uses a functional programming approach where data flows are represented as chained transformations on TypedPipes, similar to operations on Scala iterators. This avoids some limitations of the traditional Hadoop MapReduce model by allowing for more flexible multi-step jobs and features like joins. The Scalding TypeSafe API also provides compile-time type safety compared to Cascading's runtime type checking.
1) Comparable and Comparator interfaces in Java can both be used to sort collections but have some key differences. Comparable provides a single sort order while Comparator allows multiple sort orders.
2) WritableComparable is a subinterface that extends both Writable and Comparable interfaces. Any type used as a key in Hadoop MapReduce must implement this interface.
3) RawComparator is an optimization Hadoop provides to directly compare byte arrays containing serialized objects instead of deserializing for comparison. WritableComparator implements RawComparator for WritableComparable types.
Quantifying the Performance of Garbage Collection vs. Explicit Memory ManagementEmery Berger
This talk answers an age-old question: is garbage collection faster/slower/the same speed as malloc/free? We introduce oracular memory management, an approach that lets us measure unaltered Java programs as if they used malloc and free. The result: a good GC can match the performance of a good allocator, but it takes 5X more space. If physical memory is tight, however, conventional garbage collectors suffer an order-of-magnitude performance penalty.
Exploring .NET memory management - A trip down memory lane - Copenhagen .NET ...Maarten Balliauw
The .NET Garbage Collector (GC) is really cool. It helps providing our applications with virtually unlimited memory, so we can focus on writing code instead of manually freeing up memory. But how does .NET manage that memory? What are hidden allocations? Are strings evil? It still matters to understand when and where memory is allocated. In this talk, we’ll go over the base concepts of .NET memory management and explore how .NET helps us and how we can help .NET – making our apps better. Expect profiling, Intermediate Language (IL), ClrMD and more!
ConFoo - Exploring .NET’s memory management – a trip down memory laneMaarten Balliauw
The .NET Garbage Collector (GC) is really cool. It helps providing our applications with virtually unlimited memory, so we can focus on writing code instead of manually freeing up memory. But how does .NET manage that memory? What are hidden allocations? Are strings evil? It still matters to understand when and where memory is allocated. In this talk, we’ll go over the base concepts of .NET memory management and explore how .NET helps us and how we can help .NET – making our apps better. Expect profiling, Intermediate Language (IL), ClrMD and more!
The .NET Garbage Collector (GC) is really cool. It helps providing our applications with virtually unlimited memory, so we can focus on writing code instead of manually freeing up memory. But how does .NET manage that memory? What are hidden allocations? Are strings evil? It still matters to understand when and where memory is allocated. In this talk, we’ll go over the base concepts of .NET memory management and explore how .NET helps us and how we can help .NET – making our apps better. Expect profiling, Intermediate Language (IL), ClrMD and more!
The .NET Garbage Collector (GC) is really cool. It helps providing our applications with virtually unlimited memory, so we can focus on writing code instead of manually freeing up memory. But how does .NET manage that memory? What are hidden allocations? Are strings evil? It still matters to understand when and where memory is allocated. In this talk, we’ll go over the base concepts of .NET memory management and explore how .NET helps us and how we can help .NET – making our apps better. Expect profiling, Intermediate Language (IL), ClrMD and more!
JetBrains Day Seoul - Exploring .NET’s memory management – a trip down memory...Maarten Balliauw
The .NET Garbage Collector (GC) is really cool. It helps providing our applications with virtually unlimited memory, so we can focus on writing code instead of manually freeing up memory. But how does .NET manage that memory? What are hidden allocations? Are strings evil? It still matters to understand when and where memory is allocated. In this talk, we’ll go over the base concepts of .NET memory management and explore how .NET helps us and how we can help .NET – making our apps better. Expect profiling, Intermediate Language (IL), ClrMD and more!
NET Systems Programming Learned the Hard Way.pptxpetabridge
This document discusses .NET systems programming and garbage collection. It covers garbage collection generations, modes, and considerations for minimizing allocations. It also discusses eliminating delegates to reduce allocations, using value types appropriately, avoiding empty collections, and optimizing for thread locality to reduce context switching overhead. Data structures and synchronization techniques are discussed, emphasizing the importance of choosing lock-free data structures when possible to improve performance.
This document provides an overview and agenda for the JPoint 2015 conference. It includes summaries of sessions on memory leaks profiling basics, notes about the Java String class, defining and measuring technical debt, how regular expressions work under the hood, and using memory dumps and analysis tools to find memory leaks. The agenda outlines sessions on memory regions, garbage collection, identifying memory leaks through examples, JVM options for logs and dumps, String class internals, technical debt concepts, and regular expression matching algorithms.
The document discusses memory management and garbage collection in the Hotspot Java Virtual Machine. It describes different garbage collection algorithms like mark-sweep, copying, and generational collection. It explains the different garbage collectors in Hotspot JVM like serial, parallel, parallel compacting, and concurrent mark sweep collectors. It also discusses some key garbage collection terminology and metrics.
The document outlines an advanced workshop on the EnScript programming language, covering topics such as language core concepts, syntax, object model, memory management, APIs, debugging, dialogs, handling evidence, external automation, conditions, reflection, and multithreading. The workshop agenda includes language fundamentals, basic APIs, debugging the execution environment, creating dialogs, handling evidence, external communication, conditions and reflection, and multithreading. Stewart also presents three fundamental laws of EnScript regarding data structures, memory management of NodeClass objects, and the relationship between EnScript classes and EnCase views.
The document discusses optimizing code and data for CPU caches through various techniques like improving data locality, reducing unnecessary memory accesses, and reusing cached data. It covers optimizing code layout, data structures, prefetching, and addressing issues like aliasing.
The document discusses various techniques for optimizing memory usage and cache performance in code. It begins by justifying the need for memory optimization given trends in CPU and memory speeds. It then provides an overview of memory hierarchies and caches. The rest of the document discusses specific techniques for optimizing data structures, prefetching, layout of data in memory, reducing aliasing, and other strategies to improve cache utilization and performance.
- C is a commonly used language for embedded systems due to its portability, efficiency, and conciseness. It was developed in the late 1960s and early 1970s alongside Unix.
- C was designed for systems programming tasks like operating systems and compilers. It was influenced by its predecessors BCPL and B and is well-suited for direct hardware manipulation.
- C uses expressions, conditional and iterative statements, functions, and other constructs to provide a structured and portable way to write low-level systems code while avoiding the complexity of assembly.
Kafka Streams: Revisiting the decisions of the past (How I could have made it...confluent
Kafka Streams: Revisiting the decisions of the past (How I could have made it better), Jason Bell, Kafka DevOps Engineer @ Digitalis.io
https://www.meetup.com/Cleveland-Kafka/events/272339276/
The document summarizes the history and key features of the C programming language. C was developed in the late 1960s and early 1970s at Bell Labs to be a high-level language that produced efficient machine code. It was designed to allow systems programming for operating systems and utilities. C borrowed elements from its predecessors BCPL and B but added data types, structures, unions, and functions to support structured programming.
The document discusses Intel Threading Building Blocks (TBB), a C++ template library for parallel programming. TBB provides features like parallel_for to simplify parallelizing loops across CPU cores without needing expertise in threads. It uses generic programming principles and provides common parallel algorithms, concurrent data structures, and task scheduling to make parallel programming more accessible and scalable. The example shows converting a serial velocity update loop to parallel using TBB.
Utah Code Camp, Spring 2016. http://utahcodecamp.com In this presentation I describe modern C++. Modern C++ assumes features introduced in the C++11/14 standard. An overview of the new features is presented and some idioms for mdoern C++ based on those features are presented.
This document discusses garbage collection in Java. It begins by explaining the motivation for garbage collection in Java, such as avoiding memory leaks and heap corruption. It then covers the goals of garbage collectors, including minimizing memory overhead, maximizing application throughput while keeping pause times low. Different types of garbage collectors are described, such as serial, parallel, CMS, and G1 collectors. Key concepts like generations, GC roots, and safe points are also summarized.
The document appears to be a block of random letters with no discernible meaning or purpose. It consists of a series of letters without any punctuation, formatting, or other signs of structure that would indicate it is meant to convey any information. The document does not provide any essential information that could be summarized.
This document discusses Kotlin coroutines and how they can be used with the Spring Framework. It provides an overview of coroutines, explaining concepts like fibers, green threads, and suspendable computations. It also covers using coroutines with Spring features like the @Async annotation and asynchronous MVC return types. The document provides code examples of coroutines concepts like channels, jobs, and yielding in sequences.
This document provides an introduction and overview of Cassandra and NoSQL databases. It discusses the challenges faced by modern web applications that led to the development of NoSQL databases. It then describes Cassandra's data model, API, consistency model, and architecture including write path, read path, compactions, and more. Key features of Cassandra like tunable consistency levels and high availability are also highlighted.
Similar to JetBrains Australia 2019 - Exploring .NET’s memory management – a trip down memory lane (20)
Bringing nullability into existing code - dammit is not the answer.pptxMaarten Balliauw
The C# nullability features help you minimize the likelihood of encountering that dreaded System.NullReferenceException. Nullability syntax and annotations give hints as to whether a type can be nullable or not, and better static analysis is available to catch unhandled nulls while developing your code. What's not to like?
Introducing explicit nullability into an existing code bases is a Herculean effort. There's much more to it than just sprinkling some `?` and `!` throughout your code. It's not a silver bullet either: you'll still need to check non-nullable variables for null.
In this talk, we'll see some techniques and approaches that worked for me, and explore how you can migrate an existing code base to use the full potential of C# nullability.
Nerd sniping myself into a rabbit hole... Streaming online audio to a Sonos s...Maarten Balliauw
After buying a set of Sonos-compatible speakers at IKEA, I was disappointed there's no support for playing audio from a popular video streaming service. They stream Internet radio, podcasts and what not. Well, not that service I want it to play!
Determined - and not knowing how deep the rabbit hole would be - I ventured on a trip that included network sniffing on my access point, learning about UPnP and running a web server on my phone (without knowing how to write anything Android), learning how MP4 audio is packaged (and has to be re-packaged). This ultimately resulted in an Android app for personal use, which does what I initially wanted: play audio from that popular video streaming service on Sonos.
Join me for this story about an adventure that has no practical use, probably violates Terms of Service, but was fun to build!
Building a friendly .NET SDK to connect to SpaceMaarten Balliauw
Space is a team tool that integrates chats, meetings, git hosting, automation, and more. It has an HTTP API to integrate third party apps and workflows, but it's massive! And slightly opinionated.
In this session, we will see how we built the .NET SDK for Space, and how we make that massive API more digestible. We will see how we used code generation, and incrementally made the API feel more like a real .NET SDK.
Microservices for building an IDE - The innards of JetBrains Rider - NDC Oslo...Maarten Balliauw
Ever wondered how IDE’s are built? In this talk, we’ll skip the marketing bit and dive into the architecture and implementation of JetBrains Rider. We’ll look at how and why we have built (and open sourced) a reactive protocol, and how the IDE uses a “microservices” architecture to communicate with the debugger, Roslyn, a WPF renderer and even other tools like Unity3D. We’ll explore how things are wired together, both in-process and across those microservices.
Indexing and searching NuGet.org with Azure Functions and Search - .NET fwday...Maarten Balliauw
Which NuGet package was that type in again? In this session, let's build a "reverse package search" that helps finding the correct NuGet package based on a public type.
Together, we will create a highly-scalable serverless search engine using Azure Functions and Azure Search that performs 3 tasks: listening for new packages on NuGet.org (using a custom binding), indexing packages in a distributed way, and exposing an API that accepts queries and gives our clients the best result.
NDC Sydney 2019 - Microservices for building an IDE – The innards of JetBrain...Maarten Balliauw
Ever wondered how IDE’s are built? In this talk, we’ll skip the marketing bit and dive into the architecture and implementation of JetBrains Rider.
We’ll look at how and why we have built (and open sourced) a reactive protocol, and how the IDE uses a “microservices” architecture to communicate with the debugger, Roslyn, a WPF renderer and even other tools like Unity3D. We’ll explore how things are wired together, both in-process and across those microservices. Let’s geek out!
.NET Conf 2019 - Indexing and searching NuGet.org with Azure Functions and Se...Maarten Balliauw
Which NuGet package was that type in again? In this session, let's build a "reverse package search" that helps finding the correct NuGet package based on a public type.
Together, we will create a highly-scalable serverless search engine using Azure Functions and Azure Search that performs 3 tasks: listening for new packages on NuGet.org (using a custom binding), indexing packages in a distributed way, and exposing an API that accepts queries and gives our clients the best result.
https://blog.maartenballiauw.be/post/2019/07/30/indexing-searching-nuget-with-azure-functions-and-search.html
CloudBurst 2019 - Indexing and searching NuGet.org with Azure Functions and S...Maarten Balliauw
Which NuGet package was that type in again? In this session, let's build a "reverse package search" that helps finding the correct NuGet package based on a public type.
Together, we will create a highly-scalable serverless search engine using Azure Functions and Azure Search that performs 3 tasks: listening for new packages on NuGet.org (using a custom binding), indexing packages in a distributed way, and exposing an API that accepts queries and gives our clients the best result.
NDC Oslo 2019 - Indexing and searching NuGet.org with Azure Functions and SearchMaarten Balliauw
Which NuGet package was that type in again? In this session, let's build a "reverse package search" that helps finding the correct NuGet package based on a public type.
Together, we will create a highly-scalable serverless search engine using Azure Functions and Azure Search that performs 3 tasks: listening for new packages on NuGet.org (using a custom binding), indexing packages in a distributed way, and exposing an API that accepts queries and gives our clients the best result.
Approaches for application request throttling - Cloud Developer Days PolandMaarten Balliauw
Speaking from experience building a SaaS: users are insane. If you are lucky, they use your service, but in reality, they probably abuse. Crazy usage patterns resulting in more requests than expected, request bursts when users come back to the office after the weekend, and more! These all pose a potential threat to the health of our web application and may impact other users or the service as a whole. Ideally, we can apply some filtering at the front door: limit the number of requests over a given timespan, limiting bandwidth, ...
In this talk, we’ll explore the simple yet complex realm of rate limiting. We’ll go over how to decide on which resources to limit, what the limits should be and where to enforce these limits – in our app, on the server, using a reverse proxy like Nginx or even an external service like CloudFlare or Azure API management. The takeaway? Know when and where to enforce rate limits so you can have both a happy application as well as happy customers.
Indexing and searching NuGet.org with Azure Functions and Search - Cloud Deve...Maarten Balliauw
This document discusses indexing NuGet packages using Azure Functions and Azure Search to power search capabilities in ReSharper and Rider. It proposes using Functions triggered by changes to the NuGet.org catalog to download packages, index them using reflection metadata, and upload the results to an Azure Search index. Each step would be a separate function to allow independent scaling. The final system would watch the catalog, index new/updated packages, and provide APIs for searching packages by type or namespace.
Approaches for application request throttling - dotNetCologneMaarten Balliauw
Speaking from experience building a SaaS: users are insane. If you are lucky, they use your service, but in reality, they probably abuse. Crazy usage patterns resulting in more requests than expected, request bursts when users come back to the office after the weekend, and more! These all pose a potential threat to the health of our web application and may impact other users or the service as a whole. Ideally, we can apply some filtering at the front door: limit the number of requests over a given timespan, limiting bandwidth, ...
In this talk, we’ll explore the simple yet complex realm of rate limiting. We’ll go over how to decide on which resources to limit, what the limits should be and where to enforce these limits – in our app, on the server, using a reverse proxy like Nginx or even an external service like CloudFlare or Azure API management. The takeaway? Know when and where to enforce rate limits so you can have both a happy application as well as happy customers.
ConFoo Montreal - Microservices for building an IDE - The innards of JetBrain...Maarten Balliauw
Ever wondered how IDE’s are built? In this talk, we’ll skip the marketing bit and dive into the architecture and implementation of JetBrains Rider. We’ll look at how and why we have built (and open sourced) a reactive protocol, and how the IDE uses a “microservices” architecture to communicate with the debugger, Roslyn, a WPF renderer and even other tools like Unity3D. We’ll explore how things are wired together, both in-process and across those microservices. Let’s geek out!
ConFoo Montreal - Approaches for application request throttlingMaarten Balliauw
Speaking from experience building a SaaS: users are insane. If you are lucky, they use your service, but in reality, they probably abuse. Crazy usage patterns resulting in more requests than expected, request bursts when users come back to the office after the weekend, and more! These all pose a potential threat to the health of our web application and may impact other users or the service as a whole. Ideally, we can apply some filtering at the front door: limit the number of requests over a given timespan, limiting bandwidth, ...
In this talk, we’ll explore the simple yet complex realm of rate limiting. We’ll go over how to decide on which resources to limit, what the limits should be and where to enforce these limits – in our app, on the server, using a reverse proxy like Nginx or even an external service like CloudFlare or Azure API management. The takeaway? Know when and where to enforce rate limits so you can have both a happy application as well as happy customers.
Microservices for building an IDE – The innards of JetBrains Rider - TechDays...Maarten Balliauw
Ever wondered how IDE’s are built? In this talk, we’ll skip the marketing bit and dive into the architecture and implementation of JetBrains Rider. We’ll look at how and why we have built (and open sourced) a reactive protocol, and how the IDE uses a “microservices” architecture to communicate with the debugger, Roslyn, a WPF renderer and even other tools like Unity3D. We’ll explore how things are wired together, both in-process and across those microservices. Let’s geek out!
VISUG - Approaches for application request throttlingMaarten Balliauw
Speaking from experience building a SaaS: users are insane. If you are lucky, they use your service, but in reality, they probably abuse. Crazy usage patterns resulting in more requests than expected, request bursts when users come back to the office after the weekend, and more! These all pose a potential threat to the health of our web application and may impact other users or the service as a whole. Ideally, we can apply some filtering at the front door: limit the number of requests over a given timespan, limiting bandwidth, ...
In this talk, we’ll explore the simple yet complex realm of rate limiting. We’ll go over how to decide on which resources to limit, what the limits should be and where to enforce these limits – in our app, on the server, using a reverse proxy like Nginx or even an external service like CloudFlare or Azure API management. The takeaway? Know when and where to enforce rate limits so you can have both a happy application as well as happy customers.
What is going on - Application diagnostics on Azure - TechDays FinlandMaarten Balliauw
We all like building and deploying cloud applications. But what happens once that’s done? How do we know if our application behaves like we expect it to behave? Of course, logging! But how do we get that data off of our machines? How do we sift through a bunch of seemingly meaningless diagnostics? In this session, we’ll look at how we can keep track of our Azure application using structured logging, AppInsights and AppInsights analytics to make all that data more meaningful.
Everybody is consuming or producing NuGet packages these days. It’s easy, right? We’ll look beyond what everyone is doing. How can we use the NuGet client API to fetch data from NuGet? Can we build an application plugin system based on NuGet? What hidden gems are there in the NuGet server API? Can we create a full copy of NuGet.org?
Speaking from experience building MyGet.org: users are insane. If you are lucky, they use your service, but in reality, they probably abuse. Crazy usage patterns resulting in more requests than expected, request bursts when users come back to the office after the weekend, and more! These all pose a potential threat to the health of our web application and may impact other users or the service as a whole. Ideally, we can apply some filtering at the front door: limit the number of requests over a given timespan, limiting bandwidth, ...
In this talk, we’ll explore the simple yet complex realm of rate limiting. We’ll go over how to decide on which resources to limit, what the limits should be and where to enforce these limits – in our app, on the server, using a reverse proxy like Nginx or even an external service like CloudFlare or Azure API management. The takeaway? Know when and where to enforce rate limits so you can have both a happy application as well as happy customers.
Everybody is consuming NuGet packages these days. It’s easy, right? But how can we create and share our own packages? What is .NET Standard? How should we version, create, publish and share our package?
Once we have those things covered, we’ll look beyond what everyone is doing. How can we use the NuGet client API to fetch data from NuGet? Can we build an application plugin system based on NuGet? What hidden gems are there in the NuGet server API? Can we create a full copy of NuGet.org?
Good questions! In this talk, we will get them answered.
論文紹介:A Systematic Survey of Prompt Engineering on Vision-Language Foundation ...Toru Tamaki
Jindong Gu, Zhen Han, Shuo Chen, Ahmad Beirami, Bailan He, Gengyuan Zhang, Ruotong Liao, Yao Qin, Volker Tresp, Philip Torr "A Systematic Survey of Prompt Engineering on Vision-Language Foundation Models" arXiv2023
https://arxiv.org/abs/2307.12980
Blockchain technology is transforming industries and reshaping the way we conduct business, manage data, and secure transactions. Whether you're new to blockchain or looking to deepen your knowledge, our guidebook, "Blockchain for Dummies", is your ultimate resource.
Advanced Techniques for Cyber Security Analysis and Anomaly DetectionBert Blevins
Cybersecurity is a major concern in today's connected digital world. Threats to organizations are constantly evolving and have the potential to compromise sensitive information, disrupt operations, and lead to significant financial losses. Traditional cybersecurity techniques often fall short against modern attackers. Therefore, advanced techniques for cyber security analysis and anomaly detection are essential for protecting digital assets. This blog explores these cutting-edge methods, providing a comprehensive overview of their application and importance.
Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...Chris Swan
Have you noticed the OpenSSF Scorecard badges on the official Dart and Flutter repos? It's Google's way of showing that they care about security. Practices such as pinning dependencies, branch protection, required reviews, continuous integration tests etc. are measured to provide a score and accompanying badge.
You can do the same for your projects, and this presentation will show you how, with an emphasis on the unique challenges that come up when working with Dart and Flutter.
The session will provide a walkthrough of the steps involved in securing a first repository, and then what it takes to repeat that process across an organization with multiple repos. It will also look at the ongoing maintenance involved once scorecards have been implemented, and how aspects of that maintenance can be better automated to minimize toil.
How RPA Help in the Transportation and Logistics Industry.pptxSynapseIndia
Revolutionize your transportation processes with our cutting-edge RPA software. Automate repetitive tasks, reduce costs, and enhance efficiency in the logistics sector with our advanced solutions.
TrustArc Webinar - 2024 Data Privacy Trends: A Mid-Year Check-InTrustArc
Six months into 2024, and it is clear the privacy ecosystem takes no days off!! Regulators continue to implement and enforce new regulations, businesses strive to meet requirements, and technology advances like AI have privacy professionals scratching their heads about managing risk.
What can we learn about the first six months of data privacy trends and events in 2024? How should this inform your privacy program management for the rest of the year?
Join TrustArc, Goodwin, and Snyk privacy experts as they discuss the changes we’ve seen in the first half of 2024 and gain insight into the concrete, actionable steps you can take to up-level your privacy program in the second half of the year.
This webinar will review:
- Key changes to privacy regulations in 2024
- Key themes in privacy and data governance in 2024
- How to maximize your privacy program in the second half of 2024
Mitigating the Impact of State Management in Cloud Stream Processing SystemsScyllaDB
Stream processing is a crucial component of modern data infrastructure, but constructing an efficient and scalable stream processing system can be challenging. Decoupling compute and storage architecture has emerged as an effective solution to these challenges, but it can introduce high latency issues, especially when dealing with complex continuous queries that necessitate managing extra-large internal states.
In this talk, we focus on addressing the high latency issues associated with S3 storage in stream processing systems that employ a decoupled compute and storage architecture. We delve into the root causes of latency in this context and explore various techniques to minimize the impact of S3 latency on stream processing performance. Our proposed approach is to implement a tiered storage mechanism that leverages a blend of high-performance and low-cost storage tiers to reduce data movement between the compute and storage layers while maintaining efficient processing.
Throughout the talk, we will present experimental results that demonstrate the effectiveness of our approach in mitigating the impact of S3 latency on stream processing. By the end of the talk, attendees will have gained insights into how to optimize their stream processing systems for reduced latency and improved cost-efficiency.
Scaling Connections in PostgreSQL Postgres Bangalore(PGBLR) Meetup-2 - MydbopsMydbops
This presentation, delivered at the Postgres Bangalore (PGBLR) Meetup-2 on June 29th, 2024, dives deep into connection pooling for PostgreSQL databases. Aakash M, a PostgreSQL Tech Lead at Mydbops, explores the challenges of managing numerous connections and explains how connection pooling optimizes performance and resource utilization.
Key Takeaways:
* Understand why connection pooling is essential for high-traffic applications
* Explore various connection poolers available for PostgreSQL, including pgbouncer
* Learn the configuration options and functionalities of pgbouncer
* Discover best practices for monitoring and troubleshooting connection pooling setups
* Gain insights into real-world use cases and considerations for production environments
This presentation is ideal for:
* Database administrators (DBAs)
* Developers working with PostgreSQL
* DevOps engineers
* Anyone interested in optimizing PostgreSQL performance
Contact info@mydbops.com for PostgreSQL Managed, Consulting and Remote DBA Services
Kief Morris rethinks the infrastructure code delivery lifecycle, advocating for a shift towards composable infrastructure systems. We should shift to designing around deployable components rather than code modules, use more useful levels of abstraction, and drive design and deployment from applications rather than bottom-up, monolithic architecture and delivery.
Are you interested in dipping your toes in the cloud native observability waters, but as an engineer you are not sure where to get started with tracing problems through your microservices and application landscapes on Kubernetes? Then this is the session for you, where we take you on your first steps in an active open-source project that offers a buffet of languages, challenges, and opportunities for getting started with telemetry data.
The project is called openTelemetry, but before diving into the specifics, we’ll start with de-mystifying key concepts and terms such as observability, telemetry, instrumentation, cardinality, percentile to lay a foundation. After understanding the nuts and bolts of observability and distributed traces, we’ll explore the openTelemetry community; its Special Interest Groups (SIGs), repositories, and how to become not only an end-user, but possibly a contributor.We will wrap up with an overview of the components in this project, such as the Collector, the OpenTelemetry protocol (OTLP), its APIs, and its SDKs.
Attendees will leave with an understanding of key observability concepts, become grounded in distributed tracing terminology, be aware of the components of openTelemetry, and know how to take their first steps to an open-source contribution!
Key Takeaways: Open source, vendor neutral instrumentation is an exciting new reality as the industry standardizes on openTelemetry for observability. OpenTelemetry is on a mission to enable effective observability by making high-quality, portable telemetry ubiquitous. The world of observability and monitoring today has a steep learning curve and in order to achieve ubiquity, the project would benefit from growing our contributor community.
UiPath Community Day Kraków: Devs4Devs ConferenceUiPathCommunity
We are honored to launch and host this event for our UiPath Polish Community, with the help of our partners - Proservartner!
We certainly hope we have managed to spike your interest in the subjects to be presented and the incredible networking opportunities at hand, too!
Check out our proposed agenda below 👇👇
08:30 ☕ Welcome coffee (30')
09:00 Opening note/ Intro to UiPath Community (10')
Cristina Vidu, Global Manager, Marketing Community @UiPath
Dawid Kot, Digital Transformation Lead @Proservartner
09:10 Cloud migration - Proservartner & DOVISTA case study (30')
Marcin Drozdowski, Automation CoE Manager @DOVISTA
Pawel Kamiński, RPA developer @DOVISTA
Mikolaj Zielinski, UiPath MVP, Senior Solutions Engineer @Proservartner
09:40 From bottlenecks to breakthroughs: Citizen Development in action (25')
Pawel Poplawski, Director, Improvement and Automation @McCormick & Company
Michał Cieślak, Senior Manager, Automation Programs @McCormick & Company
10:05 Next-level bots: API integration in UiPath Studio (30')
Mikolaj Zielinski, UiPath MVP, Senior Solutions Engineer @Proservartner
10:35 ☕ Coffee Break (15')
10:50 Document Understanding with my RPA Companion (45')
Ewa Gruszka, Enterprise Sales Specialist, AI & ML @UiPath
11:35 Power up your Robots: GenAI and GPT in REFramework (45')
Krzysztof Karaszewski, Global RPA Product Manager
12:20 🍕 Lunch Break (1hr)
13:20 From Concept to Quality: UiPath Test Suite for AI-powered Knowledge Bots (30')
Kamil Miśko, UiPath MVP, Senior RPA Developer @Zurich Insurance
13:50 Communications Mining - focus on AI capabilities (30')
Thomasz Wierzbicki, Business Analyst @Office Samurai
14:20 Polish MVP panel: Insights on MVP award achievements and career profiling
The Rise of Supernetwork Data Intensive ComputingLarry Smarr
Invited Remote Lecture to SC21
The International Conference for High Performance Computing, Networking, Storage, and Analysis
St. Louis, Missouri
November 18, 2021
Support en anglais diffusé lors de l'événement 100% IA organisé dans les locaux parisiens d'Iguane Solutions, le mardi 2 juillet 2024 :
- Présentation de notre plateforme IA plug and play : ses fonctionnalités avancées, telles que son interface utilisateur intuitive, son copilot puissant et des outils de monitoring performants.
- REX client : Cyril Janssens, CTO d’ easybourse, partage son expérience d’utilisation de notre plateforme IA plug & play.
RPA In Healthcare Benefits, Use Case, Trend And Challenges 2024.pptxSynapseIndia
Your comprehensive guide to RPA in healthcare for 2024. Explore the benefits, use cases, and emerging trends of robotic process automation. Understand the challenges and prepare for the future of healthcare automation
3. The goal of managed memory
“Virtually unlimited memory for our applications”
.NET CLR manages a big chunk of pre-allocated memory
Allocations in that chunk
Garbage Collector (GC) reclaims unused memory
4. .NET memory management 101
Memory allocation
Objects allocated in “managed heap” (big chunk of memory)
Cheap and fast, it’s just adding a pointer
Memory release or “Garbage Collection” (GC)
Generations
Large Object Heap
5. .NET memory management 101
Memory allocation
Memory release or “Garbage Collection” (GC)
GC releases memory that’s no longer in use
Expensive!
Pause application
Build a graph of objects
Remove unreachable objects
Compact memory
Generations
Large Object Heap
6. .NET memory management 101
Memory allocation
Memory release or “Garbage Collection” (GC)
Generations
Large Object Heap
Generation 0 Generation 1 Generation 2
Short-lived objects (e.g. Local
variables)
In-between objects Long-lived objects (e.g. App’s
main form)
7. .NET memory management 101
Memory allocation
Memory release or “Garbage Collection” (GC)
Generations
Large Object Heap (LOH)
Large objects (>85KB)
Collected only during full garbage collection
Not compacted (by default)
Fragmentation can cause OutOfMemoryException
8. The .NET garbage collector
Runs often for gen0, less often for higher generations
Background GC (enabled by default)
Concurrent with application threads, pauses usually just for one thread
When does it run? Vague… But usually:
Out of memory condition – when the system fails to allocate or re-allocate memory
After some significant allocation – if X memory is allocated since previous GC
Profiler, forced, internal events
GC is not guaranteed to run
http://blogs.msdn.com/b/oldnewthing/archive/2010/08/09/10047586.aspx
http://blogs.msdn.com/b/abhinaba/archive/2008/04/29/when-does-the-net-compact-framework-garbage-collector-run.aspx
9. Throughput
More allocations, more garbage collections
Garbage collection means pauses happen
Pauses are bad
Less powerful devices (mobile)
Games (lag)
Server (“resource sharing” with others)
Trading
…
11. Can we help the GC avoid pauses?
Allocating is cheap, collecting is expensive
Use struct when it makes sense, Span<T>, ValueTuple<T>, object pooling, …
Make use of IDisposable / using statement & clean up manually
Weak references
Allow the GC to collect these objects, no need for checks
Finalizers
Beware! Moved to finalizer queue -> always gen++
14. Types
REFERENCE TYPES
Variable is a pointer to an object
Passed around by reference
Assignment copies the reference
Allocated on heap
GC involved, plenty of space
VALUE TYPES
Variable is the value
Passed around by value (copied)
Assignment copies the value
Allocated on stack
No GC involved, limited space
int, bool, struct, decimal, enum, float, byte, long, …class, string, new
18. Measure!
Don’t do premature optimization – measure!
Allocations don’t always matter (that much)
Performance counters:
How frequently are we allocating?
How frequently are we collecting?
What generation do we end up on?
Are our allocations introducing pauses?
Or use a profiler:
www.jetbrains.com/dotmemory (and www.jetbrains.com/dottrace)
22. Object pools / object re-use
Re-use objects / collections (when it makes sense)
Fewer allocations, fewer objects for the GC to clean
Less memory traffic (maybe no need for a full GC)
Object pooling - object pool pattern
System.Buffers.ArrayPool
“Borrow objects that have been allocated before”
23. Garbage Collector summary
Don’t fear allocations!
GC is optimized for high memory traffic in short-lived objects
Don’t optimize what should not be optimized…
Know when allocations happen
GC is awesome
Gen2 collection that stop the world not so much…
Measure!
25. Strings are objects
.NET tries to make them look like a value type, but they are a reference type
Read-only collection of char
Length property
A bunch of operator overloading
Allocated on the managed heap
var a = new string('-', 25);
var b = a.Substring(5);
var c = httpClient.GetStringAsync("http://blog.maartenballiauw.be");
26. String literals
Are all strings on the heap? Are all strings duplicated?
var a = "Hello, World!";
var b = "Hello, World!";
Console.WriteLine(a == b);
Console.WriteLine(Object.ReferenceEquals(a, b));
Prints true twice. So “Hello World” only in memory once?
28. String literals in #US
Compile-time optimization
Store literals only once in PE header metadata stream ECMA-335 standard, section II.24.2.4
Reference literals (IL: ldstr)
var a = Console.ReadLine();
var b = Console.ReadLine();
Console.WriteLine(a == b);
Console.WriteLine(Object.ReferenceEquals(a, b));
29. String duplicates
Any .NET application has them (System.Globalization duplicates quite a few)
Are they bad?
.NET GC is fast for short-lived objects, so meh.
Don’t waste memory with string duplicates on gen2
(but: it’s okay to have strings there)
30. String interning
Store (and read) strings from the intern pool
Simply call String.Intern when “allocating” or reading the string
Scans intern pool and returns reference
var url = "https://blog.maartenballiauw.be";
var stringList = new List<string>();
for (int i = 0; i < 1000000; i++)
{
stringList.Add(string.Intern(url + "/"));
}
31. String interning caveats
Why are not all strings interned by default?
CPU vs. memory
Not on the heap but on intern pool
No GC on intern pool – all strings in memory for AppDomain lifetime!
Rule of thumb
Lot of long-lived, few unique -> interning good
Lot of long-lived, many unique -> no benefit, memory growth
Lot of short-lived -> trust the GC
Measure!
33. How would you...
…build a managed type system, store in memory, CPU/memory friendly
Probably:
Store type info (what’s in there, what’s the offset of fieldN, …)
Store field data (just data)
Store method pointers
Inheritance information
35. .Managed heap is like a database
Pointer to an “instance”
Instance
Pointer to Runtime Type Information (RTTI)
Field values (which can be pointers in turn)
RunTime Type Information
Interface addresses
Instance method addresses
Static method addresses
…
36. Theory is nice...
Microsoft.Diagnostics.Runtime (ClrMD)
“ClrMD is a set of advanced APIs for programmatically inspecting a crash dump of
a .NET program much in the same way that the SOS Debugging Extensions (SOS)
do. This allows you to write automated crash analysis for your applications as well
as automate many common debugger tasks. In addition to reading crash dumps
ClrMD also allows supports attaching to live processes.”
“LINQ-to-heap”
Maarten’s definition
38. But... Why?
Programmatic insight into memory space of a running project
Unit test critical paths and assert behavior (did we clean up what we expected?)
Capture memory issues in running applications
Other (easier) options in this space
dotMemory Unit (JetBrains)
Benchmark.NET
41. Conclusion
Garbage Collector (GC) optimized for high memory traffic + short-lived objects
Don’t fear allocations! But beware of gen2 “stop the world”
Don’t optimize what should not be optimized…
Measure!
Using a profiler/memory analysis tool
ClrMD to automate inspections
dotMemory Unit, Benchmark.NET, … to profile unit tests
Blog series: https://blog.maartenballiauw.be
Application roots: Typically, these are global and static object pointers, local variables, and CPU registers.
Application roots: Typically, these are global and static object pointers, local variables, and CPU registers.
Application roots: Typically, these are global and static object pointers, local variables, and CPU registers.
Open TripDownMemoryLane.sln
Show WeakReferenceDemo (demo “1-1”)
Explain weak reference allows GC to collect reference
Show Cache object – has weak references to data, we expect these to probably be cleaned up by GC
Attach profiler, run demo “1-1”, snapshot, see 20 instances of WeakReference<Data>
Snapshot again, compare – see WeakReference<Data> has been regenerated a couple of times
Show DisposeObjectsDemo (demo “1-2”)
Explain first demo does not dispose and relies on GC + finalizers. This will mean our object remains in memory for two GC cycles!
Explain dispose does clean them up and requires only one cycle
In SampleDisposable, explain GC.SuppressFinalize -> tell the GC no finalizer queue work is needed here!
Open TripDownMemoryLane.sln
Show Demo02_Random
Open IL viewer tool window, show what happens in IL for each code sample
Explain IL viewer + hovering statements to see what they do
BoxingRing() – show boxing and unboxing statements in IL, explain they consume CPU and allocate an object
ParamsArray() – the call to ParamsArrayImpl() actually allocates a new string array! CPU + memory
AverageWithinBounds() – temporary class is created to capture state of all variables, then passed around
IL_0000: newobj instance void TripDownMemoryLane.Demo02.Demo02_Random/'<>c__DisplayClass3_0'::.ctor()
Lambdas() – same thing, temporary class to capture state in the loop
IL_001f: newobj instance void Allocatey.Talk.Demo02_Random/'<>c__DisplayClass4_0'::.ctor()
Show Demo02_ValidateArgumentsDemo – this one is fun!
Explain what we want to do: build a guard function – check a condition, show error
First one is the easy one, but it allocates a string and runs string.Format
Second one is better – does not allocate the string! But does allocate a function and a state capture...
Third one – allocates an array (params)
Fourth one – no allocations, yay! Using overloads...
Show heap allocations viewer!
Open TripDownMemoryLane.sln
Show BeersDemoUnoptimized (demo “3-1” and “3-2”)
Explain we’re building an application that shows all beers in the world and their ratings
Stored in beers.json (show document) with beer name, brewery, number of votes
For a view in our application, read this file into a multi-dimensional dictionary that contains breweries, beers, and their rating
Show BeerLoader and note the dictionary format
Show LoadBeersInsane and explain this is BAD BAD BAD because of the high memory usage
Show LoadBeersUnoptimized, explain what it does, optimized against the insane version as we’re streaming over our file
Load beers a number of times
Inspect snapshots
GC is very visible
Most memory in gen2 (we keep our beers around)
Compare two snapshots: high traffic on dictionary items
(Lots of string allocations - JSON.NET)
Show LoadBeersOptimized, explain what it does, re-using dictionary and updating items as we read the JSON
Load beers a number of times
Inspect snapshots
GC is almost invisible
Less allocations happening
Compare two snapshots: almost no traffic
Less work for GC, less pauses!
Measure and make it look good!
There is an old adage in IT that says “don’t do premature optimization”. In other words: maybe some allocations are okay to have, as the GC will take care of cleaning them up anyway. While some do not agree with this, I believe in the middle ground.
The garbage collector is optimized for high memory traffic in short-lived objects, and I think it’s okay to make use of what the .NET runtime has to offer us here. If it’s in a critical path of a production application, fewer allocations are better, but we can’t write software with zero allocations - it’s what our high-level programming language uses to make our developer life easier. It’s not okay to have objects go to gen2 and stay there when in fact they should be gone from memory.
Learn where allocations happen, using any of the above methods, and profile your production applications frequently to see if there are large objects in higher generations of the heap that don’t belong there.
Will print “true” twice.
Open our demo application in dotPeek
Explain PE headers
Show #US table
Open StringAllocationDemo class. Jump to IL code, show ldstr statement for strings that are in #US table
Code = trick question, what if we enter same value twice? String equals, reference not equals!
How many strings are stored
How many strings are stored
Open ClrMD.sln
Explain: two projects, one target application, one running ClrMD to analyze what we have
Open ClrMD.Explorer.Program, show attaching ClrMD
Get CLR version – gets info about the current CLR version
Get runtime – gets info about the actual runtime hosting our app
Show DumpClrInfo – get info, stress DAC data access components location – defines the runtime structures, used by ClrMD and VS Debugger etc to explore runtime while debugging/profiling/...
Explore DumpHeapObjects, stress the heap structure
Loop object addresses - foreach (var objectAddress in generation)
Get type of object at address - var type = heap.GetObjectType(objectAddress.Ptr);
Use type info to get value - type.GetValue(objectAddress.Ptr)
Explore type autocomplete – structure to get enum, method addresses, ...
Open TestsWithDMU.sln
Explain: similar Clock leak as in previous demo
Two unit tests that create the clock, and timer. Then run GC.Collect, then use dMU to check whether instances are left in memory.
Easy way to test, after investigation, when a memory leak comes back (or not)