[Spice-devel] [PATCH spice-gtk] RFC: always release shm of primary surfaces

Yonit Halperin yhalperi at redhat.com
Thu Mar 22 00:17:41 PDT 2012


On 03/21/2012 08:53 PM, Marc-André Lureau wrote:
> Note: I can't reproduce the leak, even after dozen of resolution switch.
>
> Always delete shared memory segment of primary surfaces when
> destroying its canvas.

Ack. Tested.
Just notice that it is not only for the primary surface, but for every 
surface.
> ---
>   gtk/channel-display.c |    6 +-----
>   1 files changed, 1 insertions(+), 5 deletions(-)
>
> diff --git a/gtk/channel-display.c b/gtk/channel-display.c
> index 152d6a7..8269705 100644
> --- a/gtk/channel-display.c
> +++ b/gtk/channel-display.c
> @@ -705,6 +705,7 @@ static void destroy_canvas(display_surface *surface)
>   #ifdef HAVE_SYS_SHM_H
>       else {
>           shmdt(surface->data);
> +        shmctl(surface->shmid, IPC_RMID, 0);
>       }
>   #endif
>       surface->shmid = -1;
> @@ -815,11 +816,6 @@ static void display_handle_mode(SpiceChannel *channel, SpiceMsgIn *in)
>       surface->size    = surface->height * surface->stride;
>       surface->primary = true;
>       create_canvas(channel, surface);
> -#ifdef HAVE_SYS_SHM_H
> -    if (surface->shmid != -1) {
> -        shmctl(surface->shmid, IPC_RMID, 0);
> -    }
> -#endif
So for very old spice-server and for the old qxl driver, there wouldn't 
have been a leak (since the primary surface was created with 
SPICE_MSG_DISPLAY_MODE msg, which is no longer used).
>   }
>
>   /* coroutine context */

Regards,
Yonit.



More information about the Spice-devel mailing list