Reducing the size of the ndpi_detection_module_struct structure. (#1490)
The ndpi_detection_module_struct structure contains 5 arrays "struct ndpi_call_function_struct" size 286*144=41 kB size, which are occupied by a small number of elements. At the moment we have callback_buffer_size = 172, tcp_with_payload=114, tcp_no_payload=8, udp=93, other 8. NDPI_MAX_SUPPORTED_PROTOCOLS = 285. Size of struct ndpi_detection_module_struct is 253136 bytes. Size of all structs ndpi_call_function_struct 5*286*144=205920 bytes. Real use memory size for struct ndpi_call_function_struct is (173+224)*144=57168 bytes.
This commit is contained in:
@@ -1011,20 +1011,17 @@ struct ndpi_detection_module_struct {
|
||||
void *user_data;
|
||||
#endif
|
||||
char custom_category_labels[NUM_CUSTOM_CATEGORIES][CUSTOM_CATEGORY_LABEL_LEN];
|
||||
|
||||
/* callback function buffer */
|
||||
struct ndpi_call_function_struct callback_buffer[NDPI_MAX_SUPPORTED_PROTOCOLS + 1];
|
||||
struct ndpi_call_function_struct *callback_buffer;
|
||||
struct ndpi_call_function_struct *callback_buffer_tcp_no_payload;
|
||||
struct ndpi_call_function_struct *callback_buffer_tcp_payload;
|
||||
struct ndpi_call_function_struct *callback_buffer_udp;
|
||||
struct ndpi_call_function_struct *callback_buffer_non_tcp_udp;
|
||||
u_int32_t callback_buffer_size;
|
||||
|
||||
struct ndpi_call_function_struct callback_buffer_tcp_no_payload[NDPI_MAX_SUPPORTED_PROTOCOLS + 1];
|
||||
u_int32_t callback_buffer_size_tcp_no_payload;
|
||||
|
||||
struct ndpi_call_function_struct callback_buffer_tcp_payload[NDPI_MAX_SUPPORTED_PROTOCOLS + 1];
|
||||
u_int32_t callback_buffer_size_tcp_payload;
|
||||
|
||||
struct ndpi_call_function_struct callback_buffer_udp[NDPI_MAX_SUPPORTED_PROTOCOLS + 1];
|
||||
u_int32_t callback_buffer_size_udp;
|
||||
|
||||
struct ndpi_call_function_struct callback_buffer_non_tcp_udp[NDPI_MAX_SUPPORTED_PROTOCOLS + 1];
|
||||
u_int32_t callback_buffer_size_non_tcp_udp;
|
||||
|
||||
ndpi_default_ports_tree_node_t *tcpRoot, *udpRoot;
|
||||
|
||||
Reference in New Issue
Block a user