ChangeCHR memory issues.
Displaying 1-5 of 5 total.
1
Please enter a numerical value for the importance of this sticky.
Enter 0 to unsticky.
Overkill

ChangeCHR() doesn't seem to free unused .chr files from memory unless the map is switched/reloaded. This presents a problem for people who use ChangeCHR() frequently.

<ustor> but it seems like every time a .chr is loaded in, it goes into memory and doesn't get unloaded until you change maps
<ustor> and in the setup screens, if you check the CO info, you could potentially load every .chr in the game into memory simultaneously.. which is more than the apparent 32M limit
<ustor> well, there is actually a unique .chr file for each race/color/unit combination
<Overkill> Ah
<Overkill> Hmm, so if you ChangeCHR() it doesn't free the old CHR from memory until the map's switched?
<ustor> right
<Overkill> I'd say that's a bug.
<Overkill> It should free the old image if it's unused by any other entity.
<ustor> yeah
<ustor> I think maybe it's left in memory to help boost speed, because loading new .chr files can slow it down some, depending
<ustor> but it's creating something of a problem for me now
<Overkill> Yeah.
<ustor> wtb FlushUnusedCHRs()

Posted on 2005-08-02 22:48:22

Jesse

It looks to me like there's a built-in 256 CHR limit.

There's also a internal function called CleanupCHRs that does exactly what you want. So, my suggestion is that we just to call that whenever we run out of char slots. We could use a more intelligent algorithm, but I bet that's probably sufficient.

Posted on 2005-08-03 07:48:50

vecna

ChangeCHR should NOT load up a new CHR slot unless the CHR is not already loaded. Are you saying you have more than 256 unique CHRs?

If you can run out of slots by eg, doing ChangeCHR('a.chr'); ChangeCHR('b.chr'), over and over 128 times, then its not working right.

But yeah, I suppose you CleanupCHRs could be called a few more places.

Posted on 2005-08-11 19:49:46

vecna

er, ok, so after reading the irc thing, he does apparently have a crapload of unique CHRs.

I DONT think that calling CleanupCHRs on ChangeCHR makes sense, in the sense that if you have, say, DARIN.CHR, then you change to DARIN-IN-WATER.CHR, then darin-in-water is loaded from disk. Right now, if you change back to darin.chr, its still in memory and there is no lag to pull it back from disk. If its freed the second there's no entities using it, it defeats the point. Some sort of other middleground should be reached - like when it runs out of slots, thats a good idea! :D

Posted on 2005-08-11 19:53:41

Jesse

I've (finally) done this. It just cleans up unused chr slots after it runs out.

Posted on 2005-10-15 23:05:51


Displaying 1-5 of 5 total.
1
 
Newest messages

Ben McGraw's lovingly crafted this website from scratch for years.
It's a lot prettier this go around because of Jon Wofford.
Verge-rpg.com is a member of the lunarnet irc network, and would like to take this opportunity to remind you that regardless how babies taste, it is wrong to eat them.