From: Paolo Bonzini <pbonzini@redhat.com>
To: Pooja Dhannawat <dhannawatpooja1@gmail.com>,
Stefan Hajnoczi <stefanha@gmail.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v4] socket: Allocating Large sized arrays to heap
Date: Thu, 17 Mar 2016 23:50:15 +0100 [thread overview]
Message-ID: <56EB34A7.9030601@redhat.com> (raw)
In-Reply-To: <CAPAwAwhLi9LwM-FS3eMHAkc8La2i=_H2zLc+ND2fjmk875Ye3w@mail.gmail.com>
On 17/03/2016 16:31, Pooja Dhannawat wrote:
>
>
> On Thu, Mar 17, 2016 at 8:20 PM, Stefan Hajnoczi <stefanha@gmail.com
> <mailto:stefanha@gmail.com>> wrote:
>
> On Tue, Mar 15, 2016 at 09:29:58PM +0530, Pooja Dhannawat wrote:
> > @@ -170,8 +170,8 @@ static void net_socket_send(void *opaque)
> > s->index = 0;
> > s->packet_len = 0;
> > s->nc.link_down = true;
> > - memset(s->buf, 0, sizeof(s->buf));
>
> This change is unrelated to allocating buf1 on the heap. What is the
> purpose of this line?
>
>
> I moved buf from stack to Heap, used g_new(), but I got your point if we
> need to initialize it with 0 then I have to keep that one.
>
> Other wise doing so it gets whatever garbage it has already.
This is s->buf, not buf. Also, the BiteSizedTasks page says "Make the
stack array smaller and allocate on the heap in the rare case that the
data does not fit in the small array".
Paolo
next prev parent reply other threads:[~2016-03-17 22:50 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-15 15:59 [Qemu-devel] [PATCH v4] socket: Allocating Large sized arrays to heap Pooja Dhannawat
2016-03-17 14:50 ` Stefan Hajnoczi
2016-03-17 15:31 ` Pooja Dhannawat
2016-03-17 22:50 ` Paolo Bonzini [this message]
2016-03-18 9:35 ` Stefan Hajnoczi
2016-03-18 11:12 ` Pooja Dhannawat
2016-03-18 11:24 ` Pooja Dhannawat
2016-03-18 11:51 ` Paolo Bonzini
2016-03-18 13:27 ` Jaya Tiwari
2016-03-18 13:29 ` Jaya Tiwari
2016-03-18 13:49 ` Pooja Dhannawat
2016-03-18 15:14 ` Paolo Bonzini
2016-03-18 15:58 ` Pooja Dhannawat
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=56EB34A7.9030601@redhat.com \
--to=pbonzini@redhat.com \
--cc=dhannawatpooja1@gmail.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).