Re: [Mesa-dev] Possible memory leak with `glxMakeCurrent`?

2016-09-15 Thread Eero Tamminen

Hi,

On 15.09.2016 11:00, Itai wrote:

What I should have said is I have never written anything in Mesa. I
tried making a small C program reproducing the problem, but I couldn't
get the same result (Not entirely sure what the JRE is doing).
I have run valgrind on the sample Java program, which produces a lot of
extraneous data, but I hope there is enough there to find the problem.


On a quick look I would say that the Java program / VM doesn't at exit 
get properly rid of the context(s) it creates.  Additionally, I think 
it's creating compatibility profile, because largest allocations are 
from swrast context creation (AFAIK added for compat fallbacks).





At the time the program was stopped, it's memory consumption exceeded
1.5GB, only about 200MB of them accounted for by the JVM (which means
about 1.3GB were in native/mesa code).


I would recommend killing the process with a signal that Valgrind can 
catch, but program doesn't (e.g. SIGCPU is something most programs don't 
catch :-)).  That way you see the actual run-time leaks instead of being 
confused with issues program creates with its exit code.  A lot of 
programs don't properly free their resources at exit and people often 
confuse Valgrind reports of these application's exit issues with 
run-time leakage.



- Eero


This was run using Mesa 12.0.2-1 on Debian testing. Attached is the
GZipped valgrind output, with hope it could help to find the problem, or
at least write a proper (non-Java) test case

On Thu, Aug 18, 2016 at 6:08 AM, Michel Dänzer > wrote:

On 18/08/16 05:39 AM, Itai wrote:
> (Posted initially in mesa-users, but got no reply - the list seems dead.
> Couldn't find any bug report, and sadly not well versed enough in mesa
> to file one myself).

FWIW, there's no need to be versed in Mesa to file a bug report. :)


> Following an investigation of a memory leak with JavaFX on some Linux
> configuration, it looks like there is a possible memory leak when using
> `glxMakeCurrent`.
> Sadly, I myself don't know enough about OpenGL/Mesa to describe it
> fully, but I'm hoping someone here can understand it well enough to make
> a proper bug report.
>
> Here is a link to the discussion on the openjfx-dex list:
> http://mail.openjdk.java.net/pipermail/openjfx-dev/2016-August/019577.html

>
> Here is a forum post describing a non-Java way to reproduce this same
> issue:
> http://www.gamedev.net/topic/679705-glxmakecurrent-slowly-leaks-memory/

>
>
> This was possibly not an issue in older versions of Mesa, as the bug
> does not appear on older Linux installations (I'm using Mesa 11.2.2,
> where the bug is present)

Does it still happen with current Git master? There have been some fixes
in this area recently.

If it still happens, the output of running an affected application in
valgrind --leak-check=full (with debugging symbols available for at
least all Mesa binaries) would be useful.


--
Earthling Michel Dänzer   |   http://www.amd.com
Libre software enthusiast | Mesa and X developer


___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] Possible memory leak with `glxMakeCurrent`?

2016-08-18 Thread Miklós Máté

On 08/18/2016 05:08 AM, Michel Dänzer wrote:

On 18/08/16 05:39 AM, Itai wrote:

(Posted initially in mesa-users, but got no reply - the list seems dead.
Couldn't find any bug report, and sadly not well versed enough in mesa
to file one myself).

FWIW, there's no need to be versed in Mesa to file a bug report. :)



Following an investigation of a memory leak with JavaFX on some Linux
configuration, it looks like there is a possible memory leak when using
`glxMakeCurrent`.
Sadly, I myself don't know enough about OpenGL/Mesa to describe it
fully, but I'm hoping someone here can understand it well enough to make
a proper bug report.

Here is a link to the discussion on the openjfx-dex list:
http://mail.openjdk.java.net/pipermail/openjfx-dev/2016-August/019577.html

Here is a forum post describing a non-Java way to reproduce this same
issue:
http://www.gamedev.net/topic/679705-glxmakecurrent-slowly-leaks-memory/


This was possibly not an issue in older versions of Mesa, as the bug
does not appear on older Linux installations (I'm using Mesa 11.2.2,
where the bug is present)

Does it still happen with current Git master? There have been some fixes
in this area recently.

If it still happens, the output of running an affected application in
valgrind --leak-check=full (with debugging symbols available for at
least all Mesa binaries) would be useful.


I can confirm that there is a per-makecurrent leak in 11.2, but it seems 
to be fixed in 12.0.


==28934== 1,673,408 bytes in 9,508 blocks are definitely lost in loss 
record 692 of 692

==28934==at 0x402F218: calloc (vg_replace_malloc.c:711)
==28934==by 0x525B981: r600_create_surface_custom (r600_texture.c:1202)
==28934==by 0x525BC6B: r600_create_surface (r600_texture.c:1248)
==28934==by 0x4ED2A37: st_framebuffer_validate (st_manager.c:235)
==28934==by 0x4ED3F1D: st_api_make_current (st_manager.c:783)
==28934==by 0x4FB38EA: dri_make_current (dri_context.c:245)
==28934==by 0x4FB268E: driBindContext (dri_util.c:553)
==28934==by 0x4078ABD: dri2_bind_context (dri2_glx.c:160)
==28934==by 0x4050955: MakeContextCurrent (glxcurrent.c:228)
==28934==by 0x4050AF5: glXMakeCurrent (glxcurrent.c:262)
==28934==by 0x8049210: display (makecurrent.c:92)
==28934==by 0x418451B: ??? (in /usr/lib/i386-linux-gnu/libglut.so.3.9.0)

MM

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] Possible memory leak with `glxMakeCurrent`?

2016-08-17 Thread Michel Dänzer
On 18/08/16 05:39 AM, Itai wrote:
> (Posted initially in mesa-users, but got no reply - the list seems dead.
> Couldn't find any bug report, and sadly not well versed enough in mesa
> to file one myself).

FWIW, there's no need to be versed in Mesa to file a bug report. :)


> Following an investigation of a memory leak with JavaFX on some Linux
> configuration, it looks like there is a possible memory leak when using
> `glxMakeCurrent`. 
> Sadly, I myself don't know enough about OpenGL/Mesa to describe it
> fully, but I'm hoping someone here can understand it well enough to make
> a proper bug report.  
> 
> Here is a link to the discussion on the openjfx-dex list:
> http://mail.openjdk.java.net/pipermail/openjfx-dev/2016-August/019577.html  
> 
> Here is a forum post describing a non-Java way to reproduce this same
> issue:
> http://www.gamedev.net/topic/679705-glxmakecurrent-slowly-leaks-memory/  
> 
> 
> This was possibly not an issue in older versions of Mesa, as the bug
> does not appear on older Linux installations (I'm using Mesa 11.2.2,
> where the bug is present)

Does it still happen with current Git master? There have been some fixes
in this area recently.

If it still happens, the output of running an affected application in
valgrind --leak-check=full (with debugging symbols available for at
least all Mesa binaries) would be useful.


-- 
Earthling Michel Dänzer   |   http://www.amd.com
Libre software enthusiast | Mesa and X developer
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev