[Top][All Lists]

[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 16:14:02 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0

On 18/03/2016 14:49, Pooja Dhannawat wrote:
>             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.
>         Yes Okay. Thank you for the comments.
>         I had one more question.
>         size = qemu_recv(s->fd, buf1, sizeof(buf1), 0); 
>         The one above returns bytes read into buf1 (if large then bytes
>         equivalent to len(buf1) is read) ?
>         If true, size is the correct measure of buf1? Hence, I should
>         compare the allowed stack size to "size" variable?
>        So isnt here size should be compared to "size" varibale paolo? 
> So instead of comparing with NET_BUFSIZE, should I compare with "size"
> variable? Can you help me with this? 

I was a bit confused myself; this function actually is a bit different
from the others because it does not really need a large buffer.  The
function already takes care of moving data in pieces from buf1 to
s->buf.  If you make the buffer smaller, the only change is that one
call to net_socket_send will process fewer bytes.

So you can just send a trivial patch that changes the size of the array
to something like 2048.

Thanks, and sorry for putting you on a false track!


reply via email to

[Prev in Thread] Current Thread [Next in Thread]