1 / 14

FastMM in Depth

FastMM in Depth. Primo ž Gabrijelčič, primoz @gabrijelcic.org www.thedelphigeek.com. Memory Management. “Do I really have to know anything about memory management?” No! Unless you live in the real world . Memory Management. strings. handles. forms. windows. objects. brushes. http.

dani
Download Presentation

FastMM in Depth

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. FastMM in Depth Primož Gabrijelčič, primoz@gabrijelcic.org www.thedelphigeek.com

  2. Memory Management

  3. “Do I really have to know anythingabout memory management?” No! Unless you live in the real world  Memory Management strings handles forms windows objects brushes http files

  4. A simple program … a:= 'The answer is'; a := a + ' ' + IntToStr(42); … causes not so simple flow of events. Behind the Scene ‘The answer is 42’ ‘The answer is’ ‘The answer is’ ‘42’

  5. Allocate TClass.Create, GetMem, AllocateMem, New, Create[Window,Handle,File…] Release object.Destroy/Free, FreeMem, Dispose, CloseHandle Or in Delphi terms: Create, GetMem, AllocateMem …; Destroy, Free, FreeMem .NET is different Allocate, Release

  6. In the operating system In the runtime library Intermediary between the application and OS Speed Decreased fragmentation Memory Manager

  7. Reading outside allocated area Writing outside allocated area Using released memory Bugs, Bugs, Everywhere header ‘The answer is 42’ header ‘The answer is 42’ header data header ‘What’s up Doc?’ ‘What’s up Doc?’ ‘My memory block!’ ‘My memory block!’ ‘The answer is 42’

  8. FastMM 4

  9. The Fastcode ProjectMemory Manager Challenge Pierre le Riche, fastmm.sourceforge.net Included in Delphi 2006 Supports Delphi 4⇨, C++ Builder 4⇨, Kylix 3 FastMM4

  10. Uses FastMM4; Delphi MM vs. FastMM4

  11. Three memory managers in one Small blocks (< 2,5 KB) Most frequently used (99%) Medium blocks, subdivided into small blocks Medium blocks (2,5 – 260 KB) Allocated in chunks (1,25 MB) and subdivided into lists Large blocks (> 260 KB) Allocated directly by the OS Separate locks FastMM4 Internals

  12. TopMM www.topsoftwaresite.nl Multithreaded programming SafeMM cc.embarcadero.com/item/27241 Debugging Other Memory Managers

  13. Show me the code!

  14. Q & A

More Related