 Demand Technology Software, Inc. Memory Leaks Demand Technology 1020 Eighth Avenue South, Suite 6, Naples, FL 34102 phone: (941) 261-8945 fax: (941)

Slides:



Advertisements
Similar presentations
SAP Memory Management (an Overview)
Advertisements

Paging: Design Issues. Readings r Silbershatz et al: ,
Memory Management: Overlays and Virtual Memory
计算机系 信息处理实验室 Lecture 10 Memory Management(2)
Lecture 34: Chapter 5 Today’s topic –Virtual Memories 1.
How to Detect a Memory Leak By Using System Performance Monitor in Windows 2000.
© Neeraj Suri EU-NSF ICT March 2006 Budapesti Műszaki és Gazdaságtudományi Egyetem Méréstechnika és Információs Rendszerek Tanszék Zoltán Micskei
Misc Exercise 2 updated with Part III.  Due on next Tuesday 12:30pm. Project 2 (Suggestion)  Write a small test for each call.  Start from file system.
Virtual Memory Adapted from lecture notes of Dr. Patterson and Dr. Kubiatowicz of UC Berkeley.
File System Implementation
Linux Vs. Windows NT Memory Management Hitesh Kumar
Ceng Operating Systems
Virtual Memory. Why do we need VM? Program address space: 0 – 2^32 bytes –4GB of space Physical memory available –256MB or so Multiprogramming systems.
Chapter 9 Virtual Memory Produced by Lemlem Kebede Monday, July 16, 2001.
Computer Organization Cs 147 Prof. Lee Azita Keshmiri.
Virtual Memory and Paging J. Nelson Amaral. Large Data Sets Size of address space: – 32-bit machines: 2 32 = 4 GB – 64-bit machines: 2 64 = a huge number.
©UCB CS 162 Ch 7: Virtual Memory LECTURE 13 Instructor: L.N. Bhuyan
1 Memory Management in Representative Operating Systems.
CS 241 Section Week #12 (04/22/10).
Virtual Memory By: Dinouje Fahih. Definition of Virtual Memory Virtual memory is a concept that, allows a computer and its operating system, to use a.
Systems I Locality and Caching
 Demand Technology Software, Inc. 32-bit Virtual Memory Constraints in Windows 2000 and 2003 Mark Friedman Demand Technology 1020 Eighth Avenue South,
SQL Server memory architecture and debugging memory Issues
Oracle Memory Configuration on Windows Server Configuring Large Memory for Oracle on 32-bit and 64-bit Windows.
Windows 2000 Memory Management Computing Department, Lancaster University, UK.
Conventional Memory 8088 processor could address only 1 MB
 Demand Technology Software, Inc. 32-bit Virtual Memory Constraints in Windows: an Update Mark Friedman Demand Technology 1020 Eighth Avenue South,
Operating Systems Chapter 8
Extended Memory Controller and the MPAX registers
A+ Guide to Software Managing, Maintaining and Troubleshooting THIRD EDITION Chapter 9 Managing Memory.
Managing Your Cross-Platform Data Keynote: The Power of 64 Speaker Name Here Date.
Module 1: Installing and Configuring Servers. Module Overview Installing Windows Server 2008 Managing Server Roles and Features Overview of the Server.
Lecture 19: Virtual Memory
By Teacher Asma Aleisa Year 1433 H.   Goals of memory management  To provide a convenient abstraction for programming  To allocate scarce memory resources.
Pushing the Limits of Windows
Windows Memory Architecture 井民全製作. A Process ’ s Virtual Address Space Every Process has its own private virtual address 32-bits processes  4 GB address.
Chapter 4 Memory Management Virtual Memory.
Memory Management Fundamentals Virtual Memory. Outline Introduction Motivation for virtual memory Paging – general concepts –Principle of locality, demand.
Virtual Memory 1 Chapter 13. Virtual Memory Introduction Demand Paging Hardware Requirements 4.3 BSD Virtual Memory 4.3 BSD Memory Management Operations.
Computer Systems Week 14: Memory Management Amanda Oddie.
SQL Server Memory Architecture Sumit Sarabhai Microsoft Corp.
Paging (continued) & Caching CS-3013 A-term Paging (continued) & Caching CS-3013 Operating Systems A-term 2008 (Slides include materials from Modern.
Lecture Topics: 11/24 Sharing Pages Demand Paging (and alternative) Page Replacement –optimal algorithm –implementable algorithms.
Introduction: Memory Management 2 Ideally programmers want memory that is large fast non volatile Memory hierarchy small amount of fast, expensive memory.
Demand Paging Reference Reference on UNIX memory management
Windows Server 2003 系統效能監視 林寶森
Memory Management: Overlays and Virtual Memory. Agenda Overview of Virtual Memory –Review material based on Computer Architecture and OS concepts Credits.
Windows XP Memory Management Aaron Lanoy and Jason Farnsworth.
COMP091 – Operating Systems 1 Memory Management. Memory Management Terms Physical address –Actual address as seen by memory unit Logical address –Address.
 2004 Demand Technology, Inc. Windows Performance Symposium Windows Performance Symposium – CMG 2004 Demand Technology 1020 Eighth Avenue South, Suite.
Virtual Memory 1 Computer Organization II © McQuain Virtual Memory Use main memory as a “cache” for secondary (disk) storage – Managed jointly.
Virtual Memory By CS147 Maheshpriya Venkata. Agenda Review Cache Memory Virtual Memory Paging Segmentation Configuration Of Virtual Memory Cache Memory.
Virtual Memory (Section 9.3). The Need For Virtual Memory Many computers don’t have enough memory in RAM to accommodate all the programs a user wants.
Virtual Memory Chapter 8.
CS161 – Design and Architecture of Computer
Jonathan Walpole Computer Science Portland State University
ECE232: Hardware Organization and Design
CS161 – Design and Architecture of Computer
File System Structure How do I organize a disk into a file system?
CSI 400/500 Operating Systems Spring 2009
CSCI206 - Computer Organization & Programming
Windows CE Memory Management
Computer Architecture
Oracle Memory Configuration on Windows Server
Unit OS5: Memory Management
CSE451 Virtual Memory Paging Autumn 2002
Windows Development Dynadata Copyright, 2014 © DynaData S.A. 1/22.
COMP755 Advanced Operating Systems
CS222/CS122C: Principles of Data Management UCI, Fall 2018 Notes #03 Row/Column Stores, Heap Files, Buffer Manager, Catalogs Instructor: Chen Li.
Presentation transcript:

 Demand Technology Software, Inc. Memory Leaks Demand Technology 1020 Eighth Avenue South, Suite 6, Naples, FL phone: (941) fax: (941)

 Demand Technology, Inc. Memory Leaks 2 Outline Topics  Virtual Memory concepts  Virtual Memory constraints in 32-bit Windows  Leaking processes  Page faults/sec

 Demand Technology, Inc. Memory Leaks 3 Virtual Memory Manager 4 GB virtual per process address space  Lower 2 GB - Private Page 0 reserved Code pages Heap  Upper 2 GB - System System code Shared dlls System cache User System fff ffff 16 ffff ffff 16

 Demand Technology, Inc. Memory Leaks 4 User Virtual Memory Manager  All address spaces share the virtual addresses from the same upper 2 GB of the System area  All virtual addresses in the lower 2 GB User area are unique  Shared memory in the System range can be used for IPC User System fff ffff 16 ffff ffff 16 Shared

 Demand Technology, Inc. Memory Leaks 5 Virtual Memory Manager Boot.ini /3 GB switch  Virtual storage constraint relief for some applications SQL Server Exchange 2000 Etc.

 Demand Technology, Inc. Memory Leaks 6 AWE Windows Address Windowing Extensions  Address RAM > 4 GB limit -Intel Pentium III, IV requires PSE36 Driver Real addresses only Not backed on paging files – PTEs remain 32-bit

 Demand Technology, Inc. Memory Leaks 7 Win64 Virtual Memory

 Demand Technology, Inc. Memory Leaks 8 Virtual Memory Manager Real Memory allocation Counters Available Bytes Pool non-paged Bytes, Pool Paged Resident Bytes, System Cache Resident Bytes, System Code Resident Bytes, System Driver Resident Bytes  Instantaneous Counters (all reported as Bytes)  Cache Bytes is actually the pageable System Working Set = Pool Paged Resident Bytes + System Cache Resident Bytes + System Code Resident Bytes + System Driver Resident Bytes

 Demand Technology, Inc. Memory Leaks 9 Virtual Memory Manager Memory allocation Counters Available Bytes Available KBytes Available MBytes Pool non-paged Bytes, Pool Paged Resident Bytes, System Cache Resident Bytes, System Code Resident Bytes, System Driver Resident Bytes

 Demand Technology, Inc. Memory Leaks 10 What is the difference between Pool Paged Bytes and Pool Nonpaged Bytes? Which applications would use which VM pool?

 Demand Technology, Inc. Memory Leaks 11 Virtual Memory map

 Demand Technology, Inc. Memory Leaks 12 Virtual Memory map Paged  Memory mapped files  Shared DLLs  File Server  IIS (html, jpg, gif)  Page tables nonPaged:  I/O buffers used by device drivers  TCP Session data

 Demand Technology, Inc. Memory Leaks 13 Virtual Memory map Virtual memory map is static, created once during OS initialization When any one area is full, memory allocations to that pool will fail One reserved area of virtual memory can fill up faster than the others;

 Demand Technology, Inc. Memory Leaks 14 Nonpaged pool size (ref. Q126402): MinimumNonPagedPoolSize = 256K MinAdditionNonPagedPoolPerMb = 32K DefaultMaximumNonPagedPool = 1 MB MaxAdditionNonPagedPoolPerMb = 400K PTE_PER_PAGE = 1024 PAGE_SIZE=4096 NonPagedPoolSize = MinimumNonPagedPoolSize + ((Physical MB - 4) * MinAdditionNonPagedPoolPerMB) If NonPagedPoolSize > 128 MB THEN NonPagedPoolSize = 128 MB

 Demand Technology, Inc. Memory Leaks 15 Paged pool size: Size = (2 * MaximumNonPagedPoolSize) / PAGESIZE Size = (Size + (PTE_PER_PAGE - 1)) / PTE_PER_PAGE PagedPoolSize = Size * PAGESIZE * PTE_PER_PAGE If PagedPoolSize > 192 MB THEN PagePoolSize = 192 MB Note: PagedPoolSize  sizeof (RAM) for systems < 192 MB

 Demand Technology, Inc. Memory Leaks 16 Default Paged and Nonpaged pool size can be overridden:

 Demand Technology, Inc. Memory Leaks 17 Virtual Memory constraints Virtual Memory constraints in 32-bit Windows tend to appear when sizeof (RAM)  4 GB  2 GB private area is not enough virtual memory for some applications e.g., SQL Server, Exchange database (store.exe) Due to fragmentation, it is typically not possible to allocate all 2 GB  2 GB system area is not enough virtual memory for some applications File cache for a conventional IIS-managed web site with many static.htm, jpg, gif, etc., files to retrieve

 Demand Technology, Inc. Memory Leaks 18 Virtual Memory constraints Virtual Memory constraints in 32-bit Windows tend to appear when sizeof (RAM)  4 GB  Ample RAM exists, but it is not possible for your applications to access it due to virtual memory addressing limitations  Large number of Available Bytes

 Demand Technology, Inc. Memory Leaks 19 Virtual Memory constraints So try the /3 GB switch  1 GB system area is not enough virtual memory for some applications Possible shortage of Free System Page Table Entries Possible shortage of Nonpaged Pool – Where Session data from TCP connections is stored  Due to fragmentation, it may not be possible to failover a 2 GB+ private address space (e.g., SQL Server, MS Exchange database – store.exe) using Microsoft Cluster Server (MCS) During address space recovery on the standby node, the entire virtual memory allocation is acquired at one time

 Demand Technology, Inc. Memory Leaks 20 Exchange 2000 memory tuning Exchange default memory allocation parameters are “self-tuning,” but may not be optimal on servers with > 1 GB RAM  Adjust HKLM\SYSTEM\CurrentControlSet\Services\SMTPSVC\Queuin g MsgHandleThreshold & MsgHandleAsyncThreshold HKLM\SYSTEM\CurrentControlSet\Services\Inetinfo\Parameters FileCacheMaxHandles

 Demand Technology, Inc. Memory Leaks 21 Exchange 2000 memory tuning Store DB cache  Store cache normally expands to fill RAM  But, maximum cache = 900 MB  This value can be adjusted using ADSI Edit tool: msExchESEParamCacheSizeMax msExchESEParamCacheSizeMin  Also, consider adjusting msExchESEParamLogBuffers attribute for active, back-end servers

 Demand Technology, Inc. Memory Leaks 22 Detecting memory leaks Processes that allocate virtual memory, but later “forget” to free it. MS says leaks won’t happen in.Net managed code due to automatic garbage collection But, meanwhile…, Where to look depends on whether process or system addresses are being allocated:  Per Process: Virtual Bytes, Private Bytes, Pool Paged Bytes, Handle Count  System level: Memory Pool Paged Bytes, Pool Nonpaged Bytes and the Objects Object

 Demand Technology, Inc. Memory Leaks 23 Detecting memory leaks Look for a steady increase or a sharp spike in process Virtual Bytes, or the System’s Pool Paged Bytes.  If RAM is not full, the leak may also be manifest in the Memory allocation counters and result in increased paging, if RAM fills up. For example:

 Demand Technology, Inc. Memory Leaks 24 Detecting memory leaks (1)

 Demand Technology, Inc. Memory Leaks 25 Detecting memory leaks (2)

 Demand Technology, Inc. Memory Leaks 26 Detecting memory leaks (2)

 Demand Technology, Inc. Memory Leaks 27 Detecting memory leaks (2)

 Demand Technology, Inc. Memory Leaks 28 Detecting memory leaks (2)

 Demand Technology, Inc. Memory Leaks 29 Lab exercise. Open SUPPORT EXCHG2K.sum. smf, SUPPORT EXCHG2K.sum. smf, and SUPPORT EXCHG2K.sum. smf and investigate virtual memory usage. Can you find the application that is leaking?

 Demand Technology, Inc. Memory Leaks 30 Detecting Memory Leaks (3)

 Demand Technology, Inc. Memory Leaks 31 Detecting Memory Leaks (3)

 Demand Technology, Inc. Memory Leaks 32 Detecting Memory Leaks (3)

 Demand Technology, Inc. Memory Leaks 33 Detecting Memory Leaks (3)

 Demand Technology, Inc. Memory Leaks 34 Page replacement Theoretically, Page Faults/sec  Cache faults/sec + Transition faults/sec + Demand Zero Faults/sec + Pages Read/sec But empirically…

 Demand Technology, Inc. Memory Leaks 35

 Demand Technology, Inc. Memory Leaks 36 Page replacement Empirically, Page Faults/sec  Transition faults/sec + Demand Zero Faults/sec + Pages Read/sec

 Demand Technology, Inc. Memory Leaks 37 Questions ?