12.07.2015 Views

The ns Manual (formerly ns Notes and Documentation)1 - NM Lab at ...

The ns Manual (formerly ns Notes and Documentation)1 - NM Lab at ...

The ns Manual (formerly ns Notes and Documentation)1 - NM Lab at ...

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

24.4 Memory Debugging<strong>The</strong> first thing to do if you run out of memory is to make sure you can use all the memory on your system. Some systems bydefault limit the memory available for individual programs to something less than all available memory. To relax this, use thelimit or ulimit comm<strong>and</strong>. <strong>The</strong>se are shell functio<strong>ns</strong>—see the manual page for your shell for details. Limit is for csh, ulimit isfor sh/bash.Simul<strong>at</strong>io<strong>ns</strong> of large networks can co<strong>ns</strong>ume a lot of memory. Ns-2.0b17 supports Gray W<strong>at</strong>son’s dmalloc library (see its webdocument<strong>at</strong>ion <strong>at</strong> http://www.letters.com/dmalloc/ <strong>and</strong> get the source code from ftp://ftp.letters.com/src/dmalloc/dmalloc.tar.gz). To add it, i<strong>ns</strong>tall it on your system or leave its source in a directory parallel to <strong>ns</strong>-2 <strong>and</strong> specify –with-dmalloc when configuring<strong>ns</strong>. <strong>The</strong>n build all components of <strong>ns</strong> for which you want memory inform<strong>at</strong>ion with debugging symbols (this shouldinclude <strong>at</strong> least <strong>ns</strong>-2, possibly tclcl <strong>and</strong> otcl <strong>and</strong> maybe also tcl).24.4.1 Using dmallocIn order to use dmalloc do the following:• Define an aliasfor csh: alias dmalloc ’eval ‘\dmalloc -C \!*‘’,for bash: function dmalloc { eval ‘comm<strong>and</strong> dmalloc -b $*‘ }%$• Next turn debugging on by typing dmalloc -l logfile low• Run your program (which was configured <strong>and</strong> built with dmalloc as described above).• Interpret logfile by running dmalloc_summarize <strong>ns</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!