[RFD] Pointer management
Moderator: Transport Empire Moderators
-
- Transport Empire Developer
- Posts: 699
- Joined: 03 Feb 2003 09:30
- Location: Back at the office
[RFD] Pointer management
I've been working a lot with Java lately, and the thing I like best about Java is its garbage collector. The idea that I can create objects, use them and forget about them when they're not needed anymore is quite pleasing.
This brings up the issue of Pointer management. We should definitely have some guidelines on how to handle pointers, because if we don't, we will very likely end up with one big memory-leaking mess.
I have an idea for intelligent pointers, which allow (incremental) garbage collection, but I won't bore you with details unless you're interested to hear.
Disclaimer: I probably invented a wheel that has been invented many times before, but still, I'd like to hear your ideas and views on pointer management and/or garbage collection
This brings up the issue of Pointer management. We should definitely have some guidelines on how to handle pointers, because if we don't, we will very likely end up with one big memory-leaking mess.
I have an idea for intelligent pointers, which allow (incremental) garbage collection, but I won't bore you with details unless you're interested to hear.
Disclaimer: I probably invented a wheel that has been invented many times before, but still, I'd like to hear your ideas and views on pointer management and/or garbage collection
Feel free to contact me over Email! My current timezone: Europe/Amsterdam (GMT+1 or GMT+2)
[ General TE Discussion ] [ TE Development ] [ TE Coding ]
Under construction...
Code: Select all
+------------Oo.------+
| Transport Empire -> |
+---------------------+
Under construction...
-
- Transport Empire Developer
- Posts: 699
- Joined: 03 Feb 2003 09:30
- Location: Back at the office
I'm not suggesting that we should use a garbage collector or that we should not. I'm interested to know other people's opinions on garbage collectors. And similarly on pointer management.
Of course, using garbage collectors has some pros and cons. It gives greater freedom in programming at the expense of some extra memory usage and (sometimes) decreased performance.
Of course, using garbage collectors has some pros and cons. It gives greater freedom in programming at the expense of some extra memory usage and (sometimes) decreased performance.
Feel free to contact me over Email! My current timezone: Europe/Amsterdam (GMT+1 or GMT+2)
[ General TE Discussion ] [ TE Development ] [ TE Coding ]
Under construction...
Code: Select all
+------------Oo.------+
| Transport Empire -> |
+---------------------+
Under construction...
- uzurpator
- Transport Empire Moderator
- Posts: 2178
- Joined: 10 Jan 2003 12:21
- Location: Katowice, Poland
My opinion:
Garbage collector - good for sloppy programming, bad for speed, increases memory needs.
Overloaded operators - something in between
Manual memory management - fastest, but more buggy
Imho in speed oriented tasks we should use manual management, the rest can get away with a garbage collector
Garbage collector - good for sloppy programming, bad for speed, increases memory needs.
Overloaded operators - something in between
Manual memory management - fastest, but more buggy
Imho in speed oriented tasks we should use manual management, the rest can get away with a garbage collector
All art and vehicle stats I authored for TT and derivatives are as of now PUBLIC DOMAIN! Use as you see fit
Just say NO to the TT fan-art sprite licensing madness. Public domain your art as well.
Just say NO to the TT fan-art sprite licensing madness. Public domain your art as well.
- uzurpator
- Transport Empire Moderator
- Posts: 2178
- Joined: 10 Jan 2003 12:21
- Location: Katowice, Poland
Think Java...fujitsu wrote:Is the performance benefit big enough to turn us off using garbage collectors?
All art and vehicle stats I authored for TT and derivatives are as of now PUBLIC DOMAIN! Use as you see fit
Just say NO to the TT fan-art sprite licensing madness. Public domain your art as well.
Just say NO to the TT fan-art sprite licensing madness. Public domain your art as well.
-
- Transport Empire Developer
- Posts: 699
- Joined: 03 Feb 2003 09:30
- Location: Back at the office
Java has more performance issues than just the garbage collector.
Feel free to contact me over Email! My current timezone: Europe/Amsterdam (GMT+1 or GMT+2)
[ General TE Discussion ] [ TE Development ] [ TE Coding ]
Under construction...
Code: Select all
+------------Oo.------+
| Transport Empire -> |
+---------------------+
Under construction...
-
- Engineer
- Posts: 32
- Joined: 12 Jul 2005 08:14
- Location: Melbourne suburbs, Victoria, Australia (GMT+10)
I think speed is of the essence in such a game, so we should use manual management. I guess we just need to make sure that we delete everything we create, or we will run into... large issues. It can be a bit of a bother, but in the long run is cleaner and faster. And clean and fast is good!uzurpator wrote:Ok - so it is settled - we are hard to the core and will use manual management.
Or not?
William.
-
- Engineer
- Posts: 32
- Joined: 12 Jul 2005 08:14
- Location: Melbourne suburbs, Victoria, Australia (GMT+10)
I think so.Grunt wrote:Of course, if we miss something, our gamers will be more than happy to point this out to us.fujitsu wrote:[W]e just need to make sure that we delete everything we create, or we will run into... large issues.
Topic: "TE uses huge amounts of memory"... I can just see them there now
William.
Re: [RFD] Pointer management
Hi Folks,
have you allready thought about using smart pointers? In my opinion it is a good mechanism for not using garbage collection, but forgetting about memory leaks at the same time. Since every class handles it's instances with reference counting. I love to use this mechanism for classes which are normaly instanciated a lot of times likes a matrix class. Another nice thing is, that this allows you to return references of objects with no problem. So you don't need to pass an object to a method if you wan't to write to it.
What do you think about using smart pointers for several classes?
Best regards
Jeremia
have you allready thought about using smart pointers? In my opinion it is a good mechanism for not using garbage collection, but forgetting about memory leaks at the same time. Since every class handles it's instances with reference counting. I love to use this mechanism for classes which are normaly instanciated a lot of times likes a matrix class. Another nice thing is, that this allows you to return references of objects with no problem. So you don't need to pass an object to a method if you wan't to write to it.
What do you think about using smart pointers for several classes?
Best regards
Jeremia
Re: [RFD] Pointer management
Moon instructs a student
One day a student came to Moon and said: “I understand how to make a better garbage collector. We must keep a reference count of the pointers to each cons.”
Moon patiently told the student the following story:
“One day a student came to Moon and said: ‘I understand how to make a better garbage collector ...
One day a student came to Moon and said: “I understand how to make a better garbage collector. We must keep a reference count of the pointers to each cons.”
Moon patiently told the student the following story:
“One day a student came to Moon and said: ‘I understand how to make a better garbage collector ...
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
Who is online
Users browsing this forum: No registered users and 2 guests