Jump to content

  • Log In with Google      Sign In   
  • Create Account


Making a Trivial X Windowing System Program that Doesn't Leak Memory like a Sieve


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 Geometrian   Crossbones+   -  Reputation: 1307

Like
0Likes
Like

Posted 09 February 2013 - 10:53 PM

I am just getting started with the X11 windowing system. I am trying to make a simple hello world for OpenGL that does not leak memory.
 
I am currently developing in C++ on Ubuntu 12.04 running in a virtual machine with valgrind. In the past, I have had problems with valgrind reporting many false positive errors in virtual machines, while not doing so on real ones.
 
I have tried a few simple OpenGL programs, but the one that I found most complete in terms of memory checking (this one), still leaks at least 25KB. I have not had the opportunity to test on a real machine, but given the simple nature of the program, I still suspect it is actually leaking and not a false positive (also I can dike out certain calls and it reports no leaks).
 
I am asking for a pointer to:
1: An exhaustive list of functions for X. I would like to answer my questions from the documentation. For example, Googling "XFree" will get you nowhere. I have been unable to find a complete documentation.
2: A trivial OpenGL program with an X backend that properly handles resources with no leaks. It can draw, like, a single triangle or something.
 
Thanks all!
-G


And a Unix user said rm -rf *.* and all was null and void...|There's no place like 127.0.0.1|The Application "Programmer" has unexpectedly quit. An error of type A.M. has occurred.

Sponsor:

#2 Karsten_   Members   -  Reputation: 1200

Like
1Likes
Like

Posted 10 February 2013 - 04:53 AM

Try this one http://www.opengl.org/wiki/Programming_OpenGL_in_Linux:_GLX_and_Xlib

It is much simpler.

If you are using c++, i suggest putting most things in a shared_ptr with the correct deleter function so you dont need to worry about manual memory management.

Mutiny - Open-source C++ Unity re-implementation.
Defile of Eden 2 - FreeBSD and OpenBSD binaries of our latest game.


#3 Geometrian   Crossbones+   -  Reputation: 1307

Like
0Likes
Like

Posted 10 February 2013 - 11:52 AM

Try this one http://www.opengl.org/wiki/Programming_OpenGL_in_Linux:_GLX_and_Xlib

That is indeed, a much nicer-looking code, and it works well with the virtual machine in windowed mode.

It still reports leaks, but this could be the virtual machine's doing again. I'll report back after testing on a real computer.


And a Unix user said rm -rf *.* and all was null and void...|There's no place like 127.0.0.1|The Application "Programmer" has unexpectedly quit. An error of type A.M. has occurred.

#4 Geometrian   Crossbones+   -  Reputation: 1307

Like
0Likes
Like

Posted 12 February 2013 - 03:06 PM

I'll report back after testing on a real computer.

I continued development, and then tested it on a real Ubuntu platform. Even though the virtual machine reports leaks, Valgrind on the real machine reports none.
Thanks,


And a Unix user said rm -rf *.* and all was null and void...|There's no place like 127.0.0.1|The Application "Programmer" has unexpectedly quit. An error of type A.M. has occurred.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS