From: Zhou Jie Date: Tue, 26 Apr 2016 01:26:01 +0000 (+0800) Subject: net/tap: Allocating Large sized arrays to heap X-Git-Tag: TizenStudio_2.0_p4.0~6^2~12^2~6^2~240^2~30 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=11196e95f0521fa6ba689c15f874ad9a2d99e158;p=sdk%2Femulator%2Fqemu.git net/tap: Allocating Large sized arrays to heap net_init_tap has a huge stack usage of 8192 bytes approx. Moving large arrays to heap to reduce stack usage. Signed-off-by: Zhou Jie Signed-off-by: Jason Wang --- diff --git a/net/tap.c b/net/tap.c index 740e8a2..49817c7 100644 --- a/net/tap.c +++ b/net/tap.c @@ -769,8 +769,8 @@ int net_init_tap(const NetClientOptions *opts, const char *name, return -1; } } else if (tap->has_fds) { - char *fds[MAX_TAP_QUEUES]; - char *vhost_fds[MAX_TAP_QUEUES]; + char **fds = g_new(char *, MAX_TAP_QUEUES); + char **vhost_fds = g_new(char *, MAX_TAP_QUEUES); int nfds, nvhosts; if (tap->has_ifname || tap->has_script || tap->has_downscript || @@ -818,6 +818,8 @@ int net_init_tap(const NetClientOptions *opts, const char *name, return -1; } } + g_free(fds); + g_free(vhost_fds); } else if (tap->has_helper) { if (tap->has_ifname || tap->has_script || tap->has_downscript || tap->has_vnet_hdr || tap->has_queues || tap->has_vhostfds) {