Memory leaks, output with debug SDL lib

Yep, that’s great as long as libraries are diligent about it, but
sometimes, you’ve got the straggler that didn’t or something… Nice
to have a fallback solution.

Valgrind does work with Delphi programs, too, it’s just a bit
trickier (has to be run on Wine, on Linux!). :wink:

If this program’s so useful, why hasn’t anyone ported it to Windows?

A programs usefulness isn’t defined by being available for Windows.
Contrary to popular belief, Windows isn’t the be-all & end-all of systems
for many people, and things can be relatively popular even if they’re not
on Windows.

Very true. However, for many other people, including just about all the
John Q. Publics out there, that’s precisely what it is. Also, it’s interesting
to note that Windows Vista’s abysmal user experience drove a lot more
people to the Mac than to Linux.

I’m not saying anything I just said good or right, just that it’s a fact we
have to live with.

Because honestly, as admirable as Linux is–and I’m not saying it’s
not–on technical and philosophical merit, it still has less than 1%
market share in desktop systems, which means that a Linux-only
programming tool isn’t in a position to do all that much good to
very many people.

Another way of looking at this would be; why are so many developers
tied to Windows when Linux/UNIX has such wonderful development
tools?

The chicken-and-egg paradox.

Perhaps if people moved to a more secure OS where these
tools are available, there would be much less viruses and application
problems??

There certainly would be. But you can’t sell an OS on security.
No matter how important it is, John Q Public doesn’t care. What he
wants is applications, and the perception is that all the "good"
applications are Windows-only. (And to be honest, it’s not that
far from the truth.)

This is, of course, made worse by the fact that the two most important
desktop applications are the office suite and the web browser, and
Microsoft owns the dominant apps in both categories, does not
develop them for Linux and likely never will, and has consistently
made them both use incompatible document formats from what
competing products can read. (Again, it’s not right, but it’s a fact.)

Sorry if this comes across as flamebait, but I hate the idea that
an application must exist for Windows before it’s considered 'real’
and ‘successful’.

Real? No. Successful? Hmm… sorta depends on your target market,
but if your target market is desktop users, you’d be insane to consider
your product successful when less than 1% of the target market is
even capable of loading the program.>From: Stephen Anthony

Subject: Re: [SDL] Memory leaks, output with debug SDL lib
On May 20, 2009 04:59:07 pm Mason Wheeler wrote:

----- Original Message ----
From: Pierre Phaneuf
Subject: Re: [SDL] Memory leaks, output with debug SDL lib

Very true. However, for many other people, including just about all the
John Q. Publics out there, that’s precisely what it is. Also, it’s interesting
to note that Windows Vista’s abysmal user experience drove a lot more
people to the Mac than to Linux.

I’m not saying anything I just said good or right, just that it’s a fact we
have to live with.

Well, there are great distros out there that are starting to gain hold… And with the way the economy is going, Linux will probably continue rising nowadays… FYI, “less than 1%” is no longer accurate :wink:

This is, of course, made worse by the fact that the two most important
desktop applications are the office suite and the web browser, and
Microsoft owns the dominant apps in both categories, does not
develop them for Linux and likely never will, and has consistently
made them both use incompatible document formats from what
competing products can read. (Again, it’s not right, but it’s a fact.)

IE may be more commonly used, as it comes pre-installed on any Windows machine.

But Firefox is also constantly growing in popularity. I really doubt IE would be the main reason for anybody to stick to Windows.

Real? No. Successful? Hmm… sorta depends on your target market,
but if your target market is desktop users, you’d be insane to consider
your product successful when less than 1% of the target market is
even capable of loading the program.

You code something for Linux, I think it’s because your target are Linux users. You can measure success by how many people use your applications. A better way, especially when it comes to open source, is by how good your application is. Not everything in life is about money.

Also, if 1% of Windows users were programmers, compared to 10% of Linux users, you would still have a ten-fold difference and not a hundred-fold :wink:

(Not that my numbers are accurate, just pointing it out)

Very true. ?However, for many other people, including just about all the
John Q. Publics out there, that’s precisely what it is. ?Also, it’s interesting
to note that Windows Vista’s abysmal user experience drove a lot more
people to the Mac than to Linux.

My valgrind+wine thing doesn’t have anything to do about people using
Windows or not, by the way. This is just a way that a Windows
developer, making programs for Windows users, can debug his code with
this setup. It happens to involve running Linux (just the developer,
not the users!), but it will make his Windows code better, and his
Windows users profit from this.

Just a mean to an end, Linux users gain nothing from this (well, if
you develop under Wine, they’ll probably have an easier time using
your application under Wine themselves, I suppose)…On Wed, May 20, 2009 at 5:21 PM, Mason Wheeler wrote:


http://pphaneuf.livejournal.com/

Very true. However, for many other people, including just about all the
John Q. Publics out there, that’s precisely what it is. Also, it’s interesting
to note that Windows Vista’s abysmal user experience drove a lot more
people to the Mac than to Linux.

I’m not saying anything I just said good or right, just that it’s a fact we
have to live with.

Well, there are great distros out there that are starting to gain hold… And
with the way the economy is going, Linux will probably continue rising
nowadays… FYI, “less than 1%” is no longer accurate :wink:

http://www.geek.com/articles/chips/ubuntu-904-release-helps-push-linux-os-market-share-above-1-first-time-ever-2009054/

Interesting! I hadn’t heard about that. Thanks!

This is, of course, made worse by the fact that the two most important
desktop applications are the office suite and the web browser, and
Microsoft owns the dominant apps in both categories, does not
develop them for Linux and likely never will, and has consistently
made them both use incompatible document formats from what
competing products can read. (Again, it’s not right, but it’s a fact.)

IE may be more commonly used, as it comes pre-installed on any
Windows machine.

But Firefox is also constantly growing in popularity. I really doubt IE
would be the main reason for anybody to stick to Windows.

No, but it helps. (It’s also available for the Mac. But not for Linux. So
is Office. I think I’m starting to see a pattern here. Someone inclined
to believe such things might conclude, by looking at the facts, that
Microsoft realizes that some people will not choose Windows, and is
doing everything they can to ensure that if so, at least their choice
won’t be an open-source OS.)

Real? No. Successful? Hmm… sorta depends on your target market,
but if your target market is desktop users, you’d be insane to consider
your product successful when less than 1% of the target market is
even capable of loading the program.

You code something for Linux, I think it’s because your target are Linux
users. You can measure success by how many people use your
applications. A better way, especially when it comes to open source, is
by how good your application is. Not everything in life is about money.

Even if it’s not about the money, how many people use it is still a very
good definition of success. Especially since how many people end up
using it is directly proportional to how good it is, unless you happen to
be a monopoly with howevermany different types of vendor lock-in
working in your favor. Also, this is sort of a personal distinction, but I’d
consider “people having access to it” as a quality metric just as much
as I would “program correctness” and “feature quality.”>----- Original Message ----

From: Patryk Bratkowski
Subject: Re: [SDL] Memory leaks, output with debug SDL lib

http://www.geek.com/articles/chips/ubuntu-904-release-helps-push-linux-os-market-share-above-1-first-time-ever-2009054/

Interesting! ?I hadn’t heard about that. ?Thanks!

For a short while in Germany, SuSE Linux was outselling Windows 98
(which was the current version at that time). That was pretty amazing,
but it’s got ways to go before it’s really mainstream, that’s for
sure!

I also find that making my programs cross-platform tend to make them
better overall, on every platform, in a similar way that genetic
diversity makes for stronger individuals. For example, I get to use
various platform-specific tools (like Valgrind on Linux, and Xray or
Shark on Mac OS X) on the common code, and sometimes one finds bugs
that the other didn’t, but I end up getting the union of the benefits.On Wed, May 20, 2009 at 5:57 PM, Mason Wheeler wrote:


http://pphaneuf.livejournal.com/

Long live to Linux! It is my second week using Linux :slight_smile:
I hope next good games can run on it.

I need some help here with valgrind suppression :stuck_out_tongue:
I created the file suppress.supp, and runned the app using:

valgrind --tool=memcheck --track-origins=yes --leak-check=full --suppressions=/home/bruno/Documents/suppress.supp ./Testing

But it doesnt suppressed the leaks :stuck_out_tongue:
Look at my suppress.supp attached to this mail._________________________________________________________________
Deixe suas conversas mais divertidas. Baixe agora mesmo novos emoticons. ? gr?tis!
http://specials.br.msn.com/ilovemessenger/pacotes.aspx
-------------- next part --------------
A non-text attachment was scrubbed…
Name: suppress.supp
Type: application/octet-stream
Size: 77 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20090520/02ebd0e0/attachment.obj

But it doesnt suppressed the leaks :stuck_out_tongue:
Look at my suppress.supp attached to this mail.

The first line of each suppression is the warning to suppress, so if
Valgrind ever gave you an “SDL-Suppression” warning in those
functions, they would get suppressed. But the “leak” warnings are let
through just fine… :slight_smile:

I suggest you use the --gen-suppressions=yes (or “all”, and pick out
just the ones you want) to generate them, and use them as-is,
verbatim. Once you get some more experience with them, you can start
tweaking them, but you’ll have a working starting point.On Wed, May 20, 2009 at 6:32 PM, Bruno Adami <a_j_bruno at hotmail.com> wrote:


http://pphaneuf.livejournal.com/

I ussed the gen-suppressions and now it is working :slight_smile:

The final suppression file is attached.

Thank you all for the support xD

I have another question:

When I run my SDL app, the process Xorg uses around 30% of cpu time! When nothing is opened it uses around 0-2%
Is that normal? What is that process? (I used “top” to see the cpu usage)_________________________________________________________________
Descubra todas as novidades do novo Internet Explorer 8
http://brasil.microsoft.com.br/IE8/mergulhe/?utm_source=MSN%3BHotmail&utm_medium=Tagline&utm_campaign=IE8
-------------- next part --------------
A non-text attachment was scrubbed…
Name: suppress.supp
Type: application/octet-stream
Size: 819 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20090520/aec20eca/attachment.obj

If you are using the same code from the previous email/thread, main.cpp, the
’while (1)’; is using all of your cpu.

You must be careful with loops that runs forever, they can waste your cpu
very fast.
Since you’re using SDL, you can use SDL_Delay to stop the while for 10 or 20
ms, and that is far enough to free your cpu.

2009/5/20 Bruno Adami <a_j_bruno at hotmail.com>> I ussed the gen-suppressions and now it is working :slight_smile:

The final suppression file is attached.

Thank you all for the support xD

I have another question:

When I run my SDL app, the process Xorg uses around 30% of cpu time! When
nothing is opened it uses around 0-2%
Is that normal? What is that process? (I used “top” to see the cpu usage)


Conhe?a os novos produtos Windows Live. Clique aqui!http://www.windowslive.com.br


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Since you’re using SDL, you can use SDL_Delay to stop the while for 10 or 20
ms, and that is far enough to free your cpu.

If Bruno is using SDL 1.3, he can also use SDL_WaitEventTimeout and
set the timeout to attain a specific frame rate. Check SDL_Ticks, draw
a frame, then use min(0, previous_ticks + 16 - SDL_Ticks()) to aim for
roughly 60 fps, for example (where 16 is 1000 / 60, rounded down).On Thu, May 21, 2009 at 9:38 AM, Leonardo Guilherme <leonardo.guilherme at gmail.com> wrote:


http://pphaneuf.livejournal.com/

That while(1) is just for the test program, to use with valgrind, to see if anything in Init went wrong and halt the program.
The 30% of the Xorg is happening in my game (without valgrind).
Actually in my game, I create a Timer that push an user event every 20 ms (this makes 50 fps).
In game loop I do this:

bool update()
{
SDL_Event event;
while (SDL_WaitEvent(&event))
{
switch (event.type)
{
case SDL_QUIT:
return false;
case SDL_USEREVENT:
return true;
}
}
return false;
}

Using WaitEvent, it will sleep until some event happens, saving CPU time.
If the event is QUIT, it will return false, if it is USEREVENT it will return true, if is any other it will ignore.
In the function that calls update, it will check the return value, if true it will draw and update things, if false it will finish the game.

The thing I would like to know is, why the process “Xorg” is using CPU time when my game is running!
What is that Xorg? My game uses only ± 10%.

Thank you :)_________________________________________________________________
Descubra todas as novidades do novo Internet Explorer 8
http://brasil.microsoft.com.br/IE8/mergulhe/?utm_source=MSN%3BHotmail&utm_medium=Tagline&utm_campaign=IE8

I would assume that’s what is doing the actual rendering… It’s the window system.________________________________
From: a_j_bruno@hotmail.com (Bruno Adami)
To: sdl at lists.libsdl.org
Sent: Thursday, May 21, 2009 11:24:55 AM
Subject: Re: [SDL] Memory leaks, output with debug SDL lib

That while(1) is just for the test program, to use with valgrind, to see if anything in Init went wrong and halt the program.
The 30% of the Xorg is happening in my game (without valgrind).
Actually in my game, I create a Timer that push an user event every 20 ms (this makes 50 fps).
In game loop I do this:

bool update()
{
SDL_Event event;
while (SDL_WaitEvent(&event))
{
switch (event.type)
{
case SDL_QUIT:
return false;
case SDL_USEREVENT:
return true;
}
}
return false;
}

Using WaitEvent, it will sleep until some event happens, saving CPU time.
If the event is QUIT, it will return false, if it is USEREVENT it will return true, if is any other it will ignore.
In the function that calls update, it will check the return value, if true it will draw and update things, if false it will finish the game.

The thing I would like to know is, why the process “Xorg” is using CPU time when my game is running!
What is that Xorg? My game uses only ± 10%.

Thank you :slight_smile:


Conhe?a os novos produtos Windows Live. Clique aqui!

I didn?t read the entire post but I m onto a similar problem, are u using
SDL_GL_SwapBuffers() ?

If it is the case you might want a read me previous post called
?SDL_GL_SwapBuffers() - Slow Performance? and hope someone has noticed that
the house is on fire.From: sdl-bounces@lists.libsdl.org [mailto:sdl-bounces at lists.libsdl.org] On
Behalf Of Leonardo Guilherme
Sent: Thursday, May 21, 2009 9:39 AM
To: A list for developers using the SDL library. (includes SDL-announce)
Subject: Re: [SDL] Memory leaks, output with debug SDL lib

I have another question:

When I run my SDL app, the process Xorg uses around 30% of cpu time! When
nothing is opened it uses around 0-2%
Is that normal? What is that process? (I used “top” to see the cpu usage)


Conhe?a os novos produtos Windows Live. Clique aqui!
http://www.windowslive.com.br


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

I am using SDL_Flip :)_________________________________________________________________
Conhe?a os novos produtos Windows Live! Clique aqui.
http://www.windowslive.com.br