-
Notifications
You must be signed in to change notification settings - Fork 625
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AMD GLX Memory Leak #307
Comments
Thanks for the report. It looks like it's GLX that is leaking the block of 844 bytes. GLEW doesn't have a finaliser API, and even if it did I'm not sure that GLX does. BTW does glewinfo leak on your setup? Can you attach the first 20 lines or so of the output?
|
leaks.txt |
Might I suggest doing what lua does and just provide a couple of parameters for a memory allocater and user data, this would allow glew to use them if needed but ignore them if not, either way it plays ball, I personally think that every library should provide such options. Edit: To keep API compatability you could use a seperate iniatiser function called glewInitWithAllocator( glewAllocCB allocCB, void* ud ) then have glewInit just call glewInitWithAllocator( NULL, NULL ) and pass the buck |
Closed by accident, browser behaving badly atm |
Not sure how it helps here.
|
Maybe, like I said, I'm not sure if glew is responsible for it or something further down the line, I'm not sure where to look when it involves implementation. I know it's AMD because my whole computer is a custom AMD build. If you're familiar with where to post such issues then please tell, I'll post the issue there as well and link it back to this thread, one way or another I'd like to track down the source of the leak and plug it. |
Indeed. Extracted from @awsdert 's glewinfo log:
|
If you want to narrow it further, put some early-outs (
Should be enough for valgrind to diagnose the specific GLX function that is allocating the block. I would guess |
Alright, I'll give that a try after I finish converting https://github.com/ssloy/tinyrenderer to ANSI C so I can understand how to use OpenGL properly, as it stands I'm finding the guides useless because they half-ass the information. Edit: For anyone wanting to copy my idea of learning from an existing project, this is where I found the above: https://github.com/raizam/gamedev_libraries#rendering |
I was using GLEW by directly including the header and .c file and the leak was at
right before the I also happen to have an AMD cpu, so I'm not sure if this fixes GLX leaks on other platforms or if those even have this leak to begin with. |
I hope that's the same thing valgrind complains to me about, something
about radeon.drv (On Manjaro Cinnamon x64), I only see the non-debug info
since it pops up on my own projects a lot, when looking at the reports it's
mostly that readon.drv thing, every now and then my own bugs show up but
otherwise mine appears to be fine, those readon.drv errors obscure any
other memory loss in my code so I would appreciate it if this is the fix
for it.
…On Sun, 19 Sept 2021 at 17:36, Mister Mjir ***@***.***> wrote:
I was using GLEW by directly including the header and .c file and the leak
was at glXGetClientString in glxewInit. The docs
<https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/glXGetClientString.xml>
don't mention anything about it needing to be freed, but I just added
if (*extStart != '\0') {
XFree((void *) extStart);
}
right before the return GLEW_OK. This is kinda hacky and I'm not sure if
it's 100% correct so I'm not gonna open and make a pull request with that,
but valgrind doesn't complain about the leak after adding that.
I also happen to have an AMD cpu, so I'm not sure if this fixes GLX leaks
on other platforms or if those even have this leak to begin with.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#307 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABYUIBSIR3OFYQVSY2EBZWLUCYGPVANCNFSM467MOEUQ>
.
|
I'm also seeing As per the suggestion to run Hardware is an Intel NUC (NUC10i357FN), running Ubuntu 22.04.
Side note: I used
I also experimented with
I would be willing to do more digging if you've got any suggestions. |
Due to mis-timing the end of my broadband vs the start of my unlimited mobile data (and getting sidetracked on various things) I completely forgot about this thread, anyways just for reference valgrind is still flagging issues on my setup in case anyone has already submitted to master an attempt to fix it. |
Not sure if this is from glew or not, not even sure it's this project's code that's being relied on, figure you can help me identify regardless, anyways this is what I get from valgrind when I run it on my own app:
I originally had more but to be sure it wasn't my own code causing the the bulk of them I ended up writing my own version of malloc & co with a prefix attached. I'm on Manjaro Cinnamon x64 btw.
The text was updated successfully, but these errors were encountered: