[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v4] socket: Allocating Large sized arrays to hea
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH v4] socket: Allocating Large sized arrays to heap |
Date: |
Fri, 18 Mar 2016 12:51:11 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 |
On 18/03/2016 12:24, Pooja Dhannawat wrote:
>
>
> On Fri, Mar 18, 2016 at 4:20 AM, Paolo Bonzini <address@hidden
> <mailto:address@hidden>> wrote:
>
>
>
> On 17/03/2016 16:31, Pooja Dhannawat wrote:
> >
> >
> > On Thu, Mar 17, 2016 at 8:20 PM, Stefan Hajnoczi <address@hidden
> <mailto:address@hidden>
> > <mailto:address@hidden <mailto:address@hidden>>> 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".
>
> So here, should I check with stack consumption(size of array) and if it
> is greater than accepted level, then only keep on heap?
If it is greater than the accepted level, the on-stack buffer is not
used and you allocate one that has the right size on the heap.
Paolo
> If no, Can you please help me with this one?
>
> Paolo
>
>
- [Qemu-devel] [PATCH v4] socket: Allocating Large sized arrays to heap, Pooja Dhannawat, 2016/03/15
- Re: [Qemu-devel] [PATCH v4] socket: Allocating Large sized arrays to heap, Stefan Hajnoczi, 2016/03/17
- Re: [Qemu-devel] [PATCH v4] socket: Allocating Large sized arrays to heap, Pooja Dhannawat, 2016/03/17
- Re: [Qemu-devel] [PATCH v4] socket: Allocating Large sized arrays to heap, Pooja Dhannawat, 2016/03/18
- Re: [Qemu-devel] [PATCH v4] socket: Allocating Large sized arrays to heap,
Paolo Bonzini <=
- Re: [Qemu-devel] [PATCH v4] socket: Allocating Large sized arrays to heap, Jaya Tiwari, 2016/03/18
- Re: [Qemu-devel] [PATCH v4] socket: Allocating Large sized arrays to heap, Jaya Tiwari, 2016/03/18
- Re: [Qemu-devel] [PATCH v4] socket: Allocating Large sized arrays to heap, Pooja Dhannawat, 2016/03/18
- Re: [Qemu-devel] [PATCH v4] socket: Allocating Large sized arrays to heap, Paolo Bonzini, 2016/03/18
- Re: [Qemu-devel] [PATCH v4] socket: Allocating Large sized arrays to heap, Pooja Dhannawat, 2016/03/18