[Spice-devel] [PATCH spice 06/12] Remove 2 *MB* stack frame in red_worker_main

Daniel P. Berrange berrange at redhat.com
Tue Apr 3 01:20:56 PDT 2012


On Tue, Apr 03, 2012 at 11:18:45AM +0300, Alon Levy wrote:
> On Mon, Apr 02, 2012 at 12:23:41PM +0100, Daniel P. Berrange wrote:
> > From: "Daniel P. Berrange" <berrange at redhat.com>
> > 
> > The red_worker_main method allocates a RedWorker struct instance
> > on the stack. This struct is a full 2 MB in size which is not
> > at all resonable to allocate on the stack.
> 
> Why?

You cannot assume that all OS are as generous as Linux with stack sizes.
While Linux gives each thread 10 MB by default, on Solaris you only get
2 MB by default. So this code has immediately overflowed the stack in
that case.

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|


More information about the Spice-devel mailing list