Closed Bug 318069 Opened 19 years ago Closed 13 years ago

Memory leak in clipboard handling with X client

Categories

(Core :: Widget, defect)

x86
Linux
defect
Not set
minor

Tracking

()

RESOLVED INCOMPLETE

People

(Reporter: billy.biggs, Unassigned)

Details

(Keywords: memory-leak)

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.12) Gecko/20050920 Firefox/1.0.7
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.12) Gecko/20050920 Firefox/1.0.7

Something is leaking memory whenever an X client asks for the clipboard contents, Firefox owns it, and has a lot on it.  Below is a small GTK+ application which continually asks for the clipboard contents which easily reproduces the problem.

Reproducible: Always

Steps to Reproduce:
1. Compile the folling GTK+ application:

  gcc -o clipboardtest clipboardtest.c `pkg-config --cflags --libs gtk+-2.0`

#include <stdio.h>
#include <gtk/gtk.h>

int main (int argc, char **argv)
{
    GtkWidget *window;
    GtkClipboard *cb;
    GdkAtom utf8string;
    gtk_init (&argc, &argv);
    window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
    gtk_widget_set_size_request (window, 320, 240);
    gtk_widget_show_all (window);
    cb = gtk_clipboard_get_for_display (gdk_display_get_default (),
                                        GDK_SELECTION_CLIPBOARD);
    utf8string = gdk_atom_intern ("UTF8_STRING", FALSE);
    for (;;) {
        GtkSelectionData *data;
        while (gtk_events_pending ()) gtk_main_iteration ();
        fprintf (stderr, "waiting...\n");
        data = gtk_clipboard_wait_for_contents (cb, utf8string);
        gtk_selection_data_free (data);
    }
    return 0;
}

2. Run it.
3. Run "top" in an xterm, hit "M" to sort by memory usage.
4. Load up https://bugs.eclipse.org/bugs/show_bug.cgi?id=118124 in Firefox.
5. Hit Ctrl+A to select all text on the page.
6. Hit Ctrl+C to copy the text to the clipboard.
7. Watch Firefox's memory use soar to new heights.
wild guess: bug 142128 ?
Keywords: mlk
dupe of bug 289897?
do you see this problem also in version 3.5 or newer?
Component: General → Widget
Product: Firefox → Core
Whiteboard: [closeme 2010-02-10]
(forgot to exclude this)
Severity: normal → minor
Whiteboard: [closeme 2010-02-10]
QA Contact: general → general
Anyone could test this?
Unfortunately closing this bug report as no further information has been provided. Please feel free to reopen this bug if you can provide the information asked for (comment 3 and comment 5). Thanks!
Status: UNCONFIRMED → RESOLVED
Closed: 13 years ago
Resolution: --- → WORKSFORME
(In reply to Andre Klapper from comment #6)
> Unfortunately closing this bug report as no further information has been
> provided. Please feel free to reopen this bug if you can provide the
> information asked for (comment 3 and comment 5). Thanks!

In that case, I think you mean "incomplete". Unfortunately people to test in X environment are scarce

But it's worth noting that the steps in comment 0 are quite clear. And bug 142128 is reported in an X environment. (of course, both bugs are quite old)
Resolution: WORKSFORME → INCOMPLETE
Summary: Memory leak in clipboard handling → Memory leak in clipboard handling with X client
You need to log in before you can comment on or make changes to this bug.