Nmap Development mailing list archives
Re: printtableSize() causing huge spike in memory usage at end of hostgroup
From: David Fifield <david () bamsoftware com>
Date: Mon, 16 Mar 2009 22:36:45 -0600
On Tue, Mar 17, 2009 at 02:52:37AM +0000, Brandon Enright wrote:
I've noticed for a while now that during the end of a hostgroup there is a huge spike in Nmap's memory usage. Generally this isn't an issue but I have a box that is very pressed for memory and occasionally Nmap runs it out right at the end of a huge scan. Also, it seems that in certain cases, NSE output can cause Nmap to waste a ton of memory right and the end of the hostgroup. In troubleshooting the bug Patrick pointed out with printtableSize()/printableTable() the issue is obvious. Nmap calculates the worst-case-scenario of memory usage. At the cost of a little bit more CPU time, printableTable() can be changed to dynamically realloc() memory as needed. This would eliminate the printtableSize() routine altogether. I'm willing to submit a patch for this but I'd like to hear from David/Fyodor/others before I do.
It sounds like the right solution to me. It is reminiscent of xml_convert, which used to allocate a worst-case six bytes per input byte, even though the most bytes only take up one bytes of output. If C++ STL routines make this jobs easier, then use them by all means. We don't have to be compatible with C in the Nmap codebase. David Fifield _______________________________________________ Sent through the nmap-dev mailing list http://cgi.insecure.org/mailman/listinfo/nmap-dev Archived at http://SecLists.Org
Current thread:
- printtableSize() causing huge spike in memory usage at end of hostgroup Brandon Enright (Mar 16)
- Re: printtableSize() causing huge spike in memory usage at end of hostgroup David Fifield (Mar 16)
- Re: printtableSize() causing huge spike in memory usage at end of hostgroup Fyodor (Mar 16)
- Re: printtableSize() causing huge spike in memory usage at end of hostgroup Brandon Enright (Mar 17)
- Re: printtableSize() causing huge spike in memory usage at end of hostgroup David Fifield (Mar 17)
- Re: printtableSize() causing huge spike in memory usage at end of hostgroup Brandon Enright (Mar 20)
- Re: printtableSize() causing huge spike in memory usage at end of hostgroup David Fifield (Mar 23)
- Re: printtableSize() causing huge spike in memory usage at end of hostgroup Brandon Enright (Mar 24)
- Re: printtableSize() causing huge spike in memory usage at end of hostgroup Fyodor (Mar 16)
- Re: printtableSize() causing huge spike in memory usage at end of hostgroup David Fifield (Mar 16)