Skip to content
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

Rewrite memory pools #13

Closed
DorpsGek opened this issue Nov 30, 2005 · 8 comments
Closed

Rewrite memory pools #13

DorpsGek opened this issue Nov 30, 2005 · 8 comments
Labels
flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) patch from FlySpray This issue is in fact a Patch, but imported from FlySrpay

Comments

@DorpsGek
Copy link
Member

matthijs opened the ticket and wrote:

The memory pool code needs a rewrite. I have written a replacement in two parts: One malloc() like pool which just allocates (fixed-size) blocks of memory, and another one built on top of it which also gives every drop of memory a unique index (as the current pool does).

Reported version: 0.4.0.1
Operating system: All


This issue was imported from FlySpray: https://bugs.openttd.org/task/13
@DorpsGek
Copy link
Member Author

DorpsGek commented Dec 1, 2005

Bjarni wrote:

since this should speed up NPF, we better get it in the next release, so I set it to due in 0.4.5


This comment was imported from FlySpray: https://bugs.openttd.org/task/13#comment8

@DorpsGek
Copy link
Member Author

DorpsGek commented Dec 6, 2005

matthijs wrote:

Making good progress. I've fully implemented the new memory pool, and the code compiles again.
What still needs to be done is push the new memory pool into NPF (trivial) and find memory manipulations in the code that should be handled by the new pool. In the old pool, objects would be marked as free, a station would get their xy property set to 0 for example. For the new pool to operate efficiently, it needs to know when a drop is no longer needed. When this does not happen, the game will not crash, but the memory will not be properly reused. Also, there are still a few bugs in the code.

If you wanna take a look, please do at http://kat.student.utwente.nl/~matthijs/openttd/mempool.diff (above link is also still available).


This comment was imported from FlySpray: https://bugs.openttd.org/task/13#comment18

@DorpsGek
Copy link
Member Author

matthijs wrote:

Moving due version to .4.6, since it still needs plenty of testing in the nightlies.


This comment was imported from FlySpray: https://bugs.openttd.org/task/13#comment27

@DorpsGek
Copy link
Member Author

DorpsGek commented May 1, 2006

matthijs wrote:

This code compiles and runs. It does require a thorough check and testing, however.

I will thoroughly read it through, but I will not have too much time for thorough testing. Anyone willing to run with this patch applied is encouraged to do so and eport any weird or changed behaviour.

There is currently one know issue with this implementation: shutting down a game takes too long. This is because proper cleanup code is always run for every object in a pool, even when not really necessary. For example, for every vehicle deleted, their orders are deleted individually, just before all orders are deleted. Stuff like that.

Attachments


This comment was imported from FlySpray: https://bugs.openttd.org/task/13#comment248

@DorpsGek
Copy link
Member Author

matthijs wrote:

For my own and your reference: Above patch was created against r4648 (the r313 in the .diff is from my local svk mirror)


This comment was imported from FlySpray: https://bugs.openttd.org/task/13#comment448

@DorpsGek
Copy link
Member Author

DorpsGek commented Dec 4, 2006

matthijs wrote:

So far, TrueLight has been adding parts of above giant patch to trunk. Most work is done, I'm trying to do the last pieces this or next week.


This comment was imported from FlySpray: https://bugs.openttd.org/task/13#comment676

@DorpsGek
Copy link
Member Author

Rubidium wrote:

Looks like Matthijs is taking a even bolder approach:
http://git.openttd.org/cgi-bin/gitweb.cgi?p=matthijs/trunk.git;a=shortlog;h=mempool


This comment was imported from FlySpray: https://bugs.openttd.org/task/13#comment1714

@DorpsGek
Copy link
Member Author

SmatZ closed the ticket.

Reason for closing: Implemented

After many codechanges, switching to C++ coding-style, OldPool was finally replaced by Pool in r16378.


This comment was imported from FlySpray: https://bugs.openttd.org/task/13

@DorpsGek DorpsGek added Core flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) patch from FlySpray This issue is in fact a Patch, but imported from FlySrpay labels Apr 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) patch from FlySpray This issue is in fact a Patch, but imported from FlySrpay
Projects
None yet
Development

No branches or pull requests

1 participant