qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] Discussion: vnc: memory leak in zrle_compress_data


From: Li Qiang
Subject: Re: [Qemu-devel] Discussion: vnc: memory leak in zrle_compress_data
Date: Thu, 19 Sep 2019 18:39:29 +0800

Gerd Hoffmann <address@hidden> 于2019年9月19日周四 下午4:54写道:

> On Sun, Sep 01, 2019 at 10:43:42PM +0800, Li Qiang wrote:
> > fangying <address@hidden> 于2019年9月1日周日 下午8:29写道:
> >
> > > Nice work, your patch does fix this issue in my test.
> > >
> > > I think we should make VncState.zlib to be a pointer type as well.
> > >
> > > Since we are going to use pointers instead of copy, we must make sure
> that
> > > there’s no race condition of pointer members between the local vs (vnc
> > > worker thread) and origin vs (main thread).
> > >
> > >
> >
> > Yes, there is a race between the main thread and vnc thread.
>
> Where do you see a race?  The main thread allocates the data structures
> before any job is started, cleans up after the jobs have been stopped
> and never accesses them otherwise.
>
> So unless I missed something the data structures are never accessed in
> parallel from multiple threads.
>

I checked the code again. Seems you're right.

Thanks Gerd, this strengthen my understanding of the vnc working mechanism.


Thanks,
Li Qiang


>
> > Maybe we should add a lock just like the 'vs->output_mutex'.
>
> output is a different story.  The output buffer is accessed in parallel
> (job thread produces and main thread consumes), so we actually need a
> lock here for synchronization.
>
> cheers,
>   Gerd
>
>


reply via email to

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