1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-06 04:31:29 +00:00

Changed the memory allocation strategy for NmapOutputTable from

estimating the worst-possible-case memory usage (the longest row
length times the number of rows) to a more reasonable dynamic
allocation of memory.  Now the buffer is started at 512 bytes and
approximately doubled each time it fills.  512 bytes is a compromise
that was determined empirically.  Most regular scans use less than 512
bytes.  Scans with -sV and especially -sC tend to use a few k of
memory.

See http://seclists.org/nmap-dev/2009/q1/0782.html for the tests.
This commit is contained in:
bmenrigh
2009-03-24 21:18:01 +00:00
parent 3af559b852
commit 1d732258c8
2 changed files with 21 additions and 43 deletions

View File

@@ -142,10 +142,6 @@ class NmapOutputTable {
void addItemFormatted(unsigned int row, unsigned int column, bool fullrow, const char *fmt, ...)
__attribute__ ((format (printf, 4, 5)));
// Returns the maximum size neccessary to create a printableTable() (the
// actual size could be less);
int printableSize();
// This function sticks the entire table into a character buffer.
// Note that the buffer is likely to be reused if you call the
// function again, and it will also be invalidated if you free the