⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mssdoc.htm

📁 内存检测程序源代码
💻 HTM
📖 第 1 页 / 共 5 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"><HTML><HEAD><TITLE>MSS - Memory Supervision System Version 1.2.1 Documentation</TITLE><META NAME=&quot;keywords&quot; CONTENT=&quot;mss,documentation,malloc,new,delete,programming,c,c++,dynamic,memory,allocation,free,djgpp,gcc,linux,watcom,borland,dYnamic,mEmory,aLlocation,Dynamic,Memory,Allocation,debugging,library,bugs, finding"><!--<META NAME=&quot;description&quot; CONTENT=&quot;MSS is a free (GPL) C/C++ library that helps you in the infamious task of finding bugs related to dynamical memory during the development of your programs.">--></HEAD><BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#FF0000" VLINK="#800000" ALINK="#0000FF"><TABLE CELLSPACING=2 CELLPADDING=4 BORDER=0 WIDTH="100%">  <TR><TD BGCOLOR="#C0C0FF"><H1 ALIGN="center"><FONT COLOR="#000080">MSS - Memory Supervision System Version 1.2.1 Documentation</FONT></H1></TD></TR><TR><TD BGCOLOR="#FFC0C0">Written by<BR>Juan Jesus Alcolea Picazo, <A HREF="mailto:a920101@zipi.fi.upm.es">a920101@zipi.fi.upm.es</A><BR>Peter Palotas, <A HREF="mailto:blizzar@hem1.passagen.se">blizzar@hem1.passagen.se</A><BR>and some fixes from Laurynas Biveinis <A HREF="mailto:lauras@softhome.net">lauras@softhome.net</A></TD></TR><TR VALIGN="MIDDLE"><TD BGCOLOR="#FFFFC0" VALIGN="MIDDLE">Version 1.2.1, Last updated <!--Webber_Auto_StampDNR--><!--DS-->1998-11-12<!----></TD></TR></TABLE> <P><HR><EM>This is the complete documentation for MSS, the Memory SupervisionSystem version 1.2.1, written by Juan Jesus Alcolea Picazo and Peter Palotas.</EM><HR></P><TABLE CELLSPACING=2 CELLPADDING=4 BORDER=0 WIDTH="100%"><TR><TD BGCOLOR="#C0C0FF"><FONT SIZE="+3"><FONT COLOR="#000080"><B>Contents</B></FONT></FONT></TR></TD></TABLE><P><UL><A HREF="#introduction">1. Introduction</A><BR><A HREF="#compiling-and-installing-mss">2. Compiling and installing MSS</A><BR><A HREF="#using-mss">3. Using MSS</A><BR><A HREF="#configuring-mss">4. Configuring MSS</A><BR><A HREF="#function-reference">5. Function Reference</A><BR><A HREF="#history">6. History</A><BR><A HREF="#contacting-the-authors">7. Contacting the authors</A><BR><A HREF="#copyright">8. Copyright</A><BR></UL></P><HR><TABLE CELLSPACING=2 CELLPADDING=4 BORDER=0 WIDTH="100%"><TR><TD BGCOLOR="#C0C0FF"><FONT SIZE="+3"><FONT COLOR="#000080"><A NAME="introduction"><B>1. Introduction</B></A></FONT></FONT></TD></TR></TABLE><P><UL><A HREF="#what-is-mss">1.1 What is MSS?</A><BR><A HREF="#but-what-does-it-really-do">1.2 But what does it really do?</A><BR><A HREF="#does-it-work-with-my-compiler">1.3 Does it work with my compiler</A><BR><A HREF="#do-i-have-to-pay-for-mss">1.4 Do I have to pay for MSS?</A><BR><A HREF="#where-can-i-get-mss">1.5 Where can I get the latest version of MSS?</A><BR></UL></P><P>&nbsp;</P><TABLE BORDER="0" CELLSPACING="2" CELLPADDING="4" WIDTH="100%"><TR BGCOLOR="#FFFFC0"><TD><FONT SIZE=+2><FONT COLOR="#000080"><A NAME="what-is-mss"><B>1.1 What is MSS?</B></A></FONT></FONT></TD></TR></TABLE><P>During the development of C/C++ programs dynamic memory is often allocatedusing either the standard C <I>malloc</I> family of functions or the C++operators <I>new </I>and<I> delete. </I>When allocating and using dynamicalmemory, the programmer often make mistakes which might lead to errors duringprogram execution, so called <I>bugs</I>. This could be that the program&quot;forgets&quot; to delete/free some memory (so called <I>memory leaks</I>),tries to access more memory than it allocated and a lot more. Discoveringand tracking these errors is a very difficult task, and often the errorsgo by without the programmer noticing them because the program may appear to work correctlyanyway. Therefore MSS was developed, to assist programmers in detectingsuch bugs and producing better programs.</P><P>MSS is a free (<A HREF="copying.txt">GPL</A>) C/C++library that helps you in the infamious task of finding bugs related todynamical memory during the development of your programs. With MSS youwill easily be able to detect the following bugs in your programs:</P><UL><LI>Memory leaks </LI><LI>Use of uninitialized memory </LI><LI>Zero-length allocations </LI><LI>Out of range block accesses </LI><LI>Bogus or repeated deallocations </LI><LI>Unsuccessful allocations </LI><LI>&quot;Wild&quot; or corrupted pointers </LI><LI>And more...</LI></UL><P>MSS can also give you a lot of information about the state of the dynamicalmemory allocated by your program at any point during the execution, forexample: </P><UL><LI>Total allocated memory </LI><LI>Maximum allocated memory since program start </LI><LI>Number of specific allocation/deallocation functions successfully called</LI><LI>Number of blocks allocated </LI><LI>List of blocks allocated, including the module, function and line numberwhere the allocation took place. </LI></UL><P>MSS is also <B><I>very easy</I></B> to use. Your current sources will only require <I>minor</I> changes, to enable the usage of MSS.</P><P>&nbsp;</P><TABLE BORDER="0" CELLSPACING="2" CELLPADDING="4" WIDTH="100%"><TR BGCOLOR="#FFFFC0"><TD><FONT SIZE=+2><FONT COLOR="#000080"><A NAME="but-what-does-it-really-do"><B>1.2 But what does it really do?</B></A></FONT></FONT></TD></TR></TABLE><P>MSS filters all your calls to the C functions malloc(), calloc(), realloc(), xmalloc(), xrealloc(), xfree(), cfree(), free() and strdup() and if you have a C++ compiler, also theC++ operators 'new' and 'delete'. It keeps an internal list of all the allocated blocks, together with information about where thememory was allocated, how it was allocated and some other information.</P><P>All interesting events, such as memory allocations/deallocations, detected bugs and so on are written to a log file (which alsomay be one of the standard streams stdout or stderr) which reflects all the dynamic memory related activities of your program.</P><P>You are also provided with a set of functions to control various features of MSS, and to get some interesting info in run-time,such as maximum used dynamic memory since program start and a lot of others.</P><P>You can also check that allocated memory blocks are still valid (constant blocks), that no out of range writings has occured.You can check if a certain pointer points to a valid block of memory, and a lot of other things.</P><P>When you are ready to release your project you do not have to remove all calls to the MSS function calls, because they will all compile away to nothing if you have not defined the symbol &quot;MSS&quot; to the preproccessor.</P><P>&nbsp;</P><TABLE BORDER="0" CELLSPACING="2" CELLPADDING="4" WIDTH="100%"><TR BGCOLOR="#FFFFC0"><TD><FONT SIZE=+2><FONT COLOR="#000080"><A NAME="does-it-work-with-my-compiler"><B>1.3 Does it work with my compiler?</B></A></FONT></FONT></TD></TR></TABLE><P>MSS was written with the intention of being fully portable to any compiler/platformthat supports the ANSI&nbsp;C/C++ standard. Since the C++ ANSI&nbsp;standardwas just recently finished however, there are a lot of diffrent C++ dialectsout there, and some may not be fully compatible with the C++ section ofMSS. Some configuring options were therefore added to make MSS&nbsp;supportas many compilers as possible. The C section of MSS however, should befully ANSI compliant and therefore work with all ANSI&nbsp;compatible C&nbsp;compilers, with only minor configuration.</P><P>MSS&nbsp;was written using GCC 2.7.2.1, and has also been tested usingGCC&nbsp;2.8.0, GCC 2.8.1, EGCS-1.1 and GCC 2.95.3 and it compiles without any problems on these compilers.This also goes for the excellent DJGPP, the DOS&nbsp;port of GCC (with which MSS actually was developed). If yourcompiler is a 32-bit compiler for the i386 family of processors, buildingMSS should be no problems, other platforms are untested, but any reportsof successful (or unsuccessful) usage of MSS&nbsp;are very welcome.</P><P>Currently there are two "makefiles" supplied with this package. One makefile was written for usage withthe GNU C/C++ compiler (GCC) and GNU Make. (It will also require the GNUFileutils for some operations), this is called "Makefile".  The other one is a project-file for Borland C++ 5.02, composed by Rolf F. Katzenberger, this one is called "borland.ide". However we really would like to includemore makefiles with MSS, so if you have another compiler, and are ableto write a makefile for it, please do so and send it to us. We will beglad to include it in our next release.</P><P>If you use another compiler, and can't seem to get MSS to work with it,don't hesitate to <A HREF="#contacting-the-authors">contact us</A>. We will do everything we can to help you.</P><P>&nbsp;</P><TABLE BORDER="0" CELLSPACING="2" CELLPADDING="4" WIDTH="100%"><TR BGCOLOR="#FFFFC0"><TD><FONT SIZE=+2><FONT COLOR="#000080"><A NAME="do-i-have-to-pay-for-mss"><B>1.4 Do I have to pay for MSS?</B></A></FONT></FONT></TD></TR></TABLE><P>No, you will never have to pay anything for using MSS. MSS is free software;you can redistribute it and/or modify it under the terms of the <A HREF="copying.txt">GNUGeneral Public License</A> as published by the <A HREF="http://www.fsf.org/">FreeSoftware Foundation</A>; either version 2 of the License, or (at your option)any later version.</P><P>&nbsp;</P><TABLE BORDER="0" CELLSPACING="2" CELLPADDING="4" WIDTH="100%"><TR BGCOLOR="#FFFFC0"><TD><FONT SIZE=+2><FONT COLOR="#000080"><A NAME="where-can-i-get-mss"><B>1.5 Where can I get the latest version of MSS?</B></A></FONT></FONT></TD></TR></TABLE><P>The latest version of MSS can always be found at <A HREF="http://hem1.passagen.se/blizzar/mss/index.html">http://hem1.passagen.se/blizzar/mss/index.html</A>.</P><P>MSS is also available from various FTP-sites.  Among others it should be available from <A HREF ="ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2tk/mss12.zip">ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2tk/mss12.zip</A> and ofcourse from any other simtelnet mirror. Note that it is <EM>not</EM> a DJGPP specific version, but it will (should) work with any ANSI C compliable compiler.</P><HR><TABLE CELLSPACING=2 CELLPADDING=4 BORDER=0 WIDTH="100%"><TR><TD BGCOLOR="#C0C0FF"><FONT SIZE="+3"><FONT COLOR="#000080"><A NAME="compiling-and-installing-mss"><B>2. Compiling and Installing MSS</B></A></FONT></FONT></TD></TR></TABLE><P><UL><A HREF="#unpacking-the-archive">2.1 Unpacking the archive</A><BR><A HREF="#configuring-mss-for-your-compiler">2.2 Configuring MSS for your compiler</A><BR><A HREF="#compiling-and-installing-mss-using-gcc">2.3 Compiling and installing MSS using GCC</A><BR><A HREF="#compiling-and-installing-mss-using-borland">2.4 Compiling and installing MSS using Borland C++ 5.02</A><BR><A HREF="#compiling-and-installing-mss-using-other-compiler">2.5 Compiling and installing MSS using another compiler.</A></UL></P><P>&nbsp;</P><TABLE BORDER="0" CELLSPACING="2" CELLPADDING="4" WIDTH="100%"><TR BGCOLOR="#FFFFC0"><TD><FONT SIZE=+2><FONT COLOR="#000080"><A NAME="unpacking-the-archive"><B>2.1 Unpacking the archive</B></A></FONT></FONT></TD></TR></TABLE><P>You have to unpack the archive preserving the directory structure. Depending on your platform there are diffrent was to do this, but under linux the 'unzip' program automagically preserves the directory structure, and in DOS you should specify the '-d' switch to 'pkunzip'.</P><P>Start by unpacking the archive in a proper directory, under DJGPP we recommend &quot;%DJDIR%/contrib/&quot;, i.e. the contrib directory in the directory where you installed DJGPP, usually 'C:\DJGPP\CONTRIB\' or something like that.<PRE>pkunzip -d mss12.ziporunzip mss12.zip

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -