Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411519 Posts in 69377 Topics- by 58431 Members - Latest Member: Bohdan_Zoshchenko

April 28, 2024, 04:14:34 AM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)The grumpy old programmer room
Pages: 1 ... 193 194 [195] 196 197 ... 295
Print
Author Topic: The grumpy old programmer room  (Read 738924 times)
Klaim
Level 10
*****



View Profile WWW
« Reply #3880 on: January 26, 2013, 03:47:59 PM »

Memory leaks. Memory leaks everywhere.
C/C++?

You can memory leak with almost any language.
Logged

zacaj
Level 3
***


void main()


View Profile WWW
« Reply #3881 on: January 26, 2013, 03:53:50 PM »

Memory leaks. Memory leaks everywhere.
C/C++?

You can memory leak with almost any language.
Your point?  That has nothing to do with my question.
Logged

My twitter: @zacaj_

Quote from: mcc
Well let's just take a look at this "getting started" page and see--
Quote
Download and install cmake
Noooooooo
kamac
Level 10
*****


Notoriously edits his posts


View Profile
« Reply #3882 on: January 26, 2013, 04:00:27 PM »

Memory leaks. Memory leaks everywhere.
C/C++?

Definitely.

I bet you are about to give me some cool memory-leaks detector program/technique right now. Am I right?
Logged

Klaim
Level 10
*****



View Profile WWW
« Reply #3883 on: January 26, 2013, 04:00:39 PM »

Memory leaks. Memory leaks everywhere.
C/C++?

You can memory leak with almost any language.
Your point?  That has nothing to do with my question.

That "maybe not" C/C++. Nothing more.
Logged

Klaim
Level 10
*****



View Profile WWW
« Reply #3884 on: January 26, 2013, 04:03:23 PM »

Memory leaks. Memory leaks everywhere.
C/C++?

Definitely.

I bet you are about to give me some cool memory-leaks detector program/technique right now. Am I right?

Not really, I use VLD on Visual Studio but no memory leak detector is perfect unfortunately.
I would recommand using "modern c++" to avoid memory leaks in the first place (if you use C++, not C).
Logged

kamac
Level 10
*****


Notoriously edits his posts


View Profile
« Reply #3885 on: January 26, 2013, 04:11:24 PM »

Memory leaks. Memory leaks everywhere.
C/C++?

Definitely.

I bet you are about to give me some cool memory-leaks detector program/technique right now. Am I right?

Not really, I use VLD on Visual Studio but no memory leak detector is perfect unfortunately.
I would recommand using "modern c++" to avoid memory leaks in the first place (if you use C++, not C).

It has to work for android NDK too and for now I couldn't get, for example C++11x's std::function to work. (Since android NDK doesn't seem to support modern C++. Or it's my compiler. I wonder if there are any other)
Logged

Klaim
Level 10
*****



View Profile WWW
« Reply #3886 on: January 26, 2013, 04:18:37 PM »


It has to work for android NDK too and for now I couldn't get, for example C++11x's std::function to work. (Since android NDK doesn't seem to support modern C++. Or it's my compiler. I wonder if there are any other)

I wasn't talking about c++11.

(Apparently the Android SDK isn't up to date with recent GCC version so you can use C++11 but only in limited ways; also it should be available in the std::tr1 namespace but I didn't check which header because I remember the old gcc header being non-standard for std TR1 stuffs. It that can help you, you'd better use boost if you want to use boost::function, you can just get the boost headers without compilation and boost::function -and may other libs- will work out of the box)


Modern C++ is just a way of saying "idiomatic c++" which is in mainly exploiting RAII. Unfortunately very hard to sum up here, and I don't know what you know to help you.
Logged

zacaj
Level 3
***


void main()


View Profile WWW
« Reply #3887 on: January 26, 2013, 04:25:37 PM »

Memory leaks. Memory leaks everywhere.
C/C++?

You can memory leak with almost any language.
Your point?  That has nothing to do with my question.

That "maybe not" C/C++. Nothing more.
That's sorta the point of asking.  

Memory leaks. Memory leaks everywhere.
C/C++?

Definitely.

I bet you are about to give me some cool memory-leaks detector program/technique right now. Am I right?
Yep.  Nothing mind blowing, but I thought I'd post the code I worked out for tracking allocations.  Will probably need a bit of modifications to work into your code, but hopefully will be helpful Smiley  If you run into problems, PM/email me and I'll try to help

http://pastebin.com/zDtkSPbs

It overrides new and delete and keeps a list of everything allocated, and prints a list of what was left over when you exit.
Logged

My twitter: @zacaj_

Quote from: mcc
Well let's just take a look at this "getting started" page and see--
Quote
Download and install cmake
Noooooooo
kamac
Level 10
*****


Notoriously edits his posts


View Profile
« Reply #3888 on: January 27, 2013, 02:39:26 AM »

Quote from: Klaim
you'd better use boost if you want to use boost::function, you can just get the boost headers without compilation and boost::function -and may other libs- will work out of the box

I already use it Giggle

And thanks zacaj, that's rad Smiley
I won't hesitate to PM you when needed either.
Logged

rivon
Level 10
*****



View Profile
« Reply #3889 on: January 27, 2013, 04:01:19 AM »

Valgrind Wink
Logged
nikki
Level 10
*****


View Profile
« Reply #3890 on: January 27, 2013, 04:13:33 AM »

valgrind +1
Logged
Klaim
Level 10
*****



View Profile WWW
« Reply #3891 on: January 28, 2013, 02:50:24 PM »

Just lost 4 hours hunting a double bug.
The initial bug was trigerring another bug that generated a deadlock (yeah I'm having "fun" with multiple threads and processes, quite the ride).
I fixed the deadlock after 2 hours, it was just a logic problem and missing functionality on error reporting.

The core bug was in the following code. Will you find it? It's easy but I missed it several time while reviewing the code.
It appeared only in Release/ReleaseDebug modes AND only if I execute it outside the debugger (which I still don't understand).

Code:
explicit ZoneElement( IdType id ) 
: m_id( std::move(m_id), static_cast<T&>(*this) ) // Augment the id object with a pointer to this.
{
NR_LOG_TRACE( "FROM explicit ZoneElement( IdType id )" );
check_validity();
}


I'm also unhappy that visual studio compiler didn't point the problem. I know clang and gcc would have.  Tired
Logged

BorisTheBrave
Level 10
*****


View Profile WWW
« Reply #3892 on: January 28, 2013, 03:29:31 PM »

You are initializing a variable with itself? What made you think that was a good idea.
Logged
Klaim
Level 10
*****



View Profile WWW
« Reply #3893 on: January 28, 2013, 03:38:46 PM »

Exactly, this code have been modified a lot so I made the typo. But the compiler didn't point the fact that I wasn't using one of the arguments of the function...clang and gcc would have pointed this. Even PVS-Studio didnt point this to my great surprise.

Also, this more or less works when the debugger runs. I mean, I got no error, the id isn't null, while it should be (it's its default value) so I have no idea yet how I could have missed it.

I discovered the problem when the serialization code whas checking (in release too) that the id was invalid while it shouldn't be.
Logged

Geti
Level 10
*****



View Profile WWW
« Reply #3894 on: January 28, 2013, 08:05:52 PM »

>find bugs in the 2d vector class used by >40 classes.
 Crazy
Logged

Muz
Level 10
*****


View Profile
« Reply #3895 on: January 28, 2013, 08:35:05 PM »

Memory leaks. Memory leaks everywhere.
C/C++?

You can memory leak with almost any language.

Yeah, but much more easily with C/C++. Avoiding memory leaks in C(++) is a trained skill in itself Tongue
Logged
Code_Assassin
Level 5
*****


freedom


View Profile
« Reply #3896 on: January 28, 2013, 09:20:28 PM »

>find bugs in the 2d vector class used by >40 classes.
 Crazy

lol how did that even happen?Huh? O_O
Logged
Geti
Level 10
*****



View Profile WWW
« Reply #3897 on: January 28, 2013, 09:52:52 PM »

lol how did that even happen?Huh? O_O
Some legacy shit, potentially optimisation related, not my code, still my problem. Tired
Logged

eigenbom
Level 10
*****


@eigenbom


View Profile WWW
« Reply #3898 on: January 28, 2013, 11:21:21 PM »

stuffing around with win32 all day to "quickly make a simple and minimal launcher for moonman". big mistake. fwiw win32++ eased my pain. the crappiest thing is that I already had written a launcher using fltk, but thought that using win32 would allow the combobox to be drawn outside of its parent window, but alas no.
Logged

Liosan
Level 2
**


View Profile
« Reply #3899 on: January 29, 2013, 12:37:08 AM »

>find bugs in the 2d vector class used by >40 classes.
 Crazy
... did you break some other classes after you fixed the vector?

Happened to me once... bugs hidden under bugs...

Liosan
Logged

Pages: 1 ... 193 194 [195] 196 197 ... 295
Print
Jump to:  

Theme orange-lt created by panic