Two words: memory fragmentation It's not a speed issue.. malloc is pretty fast anyway. It's that when you're allocating and freeing odd-sized chunks of memory over and over for long periods of time, you end up with small, unusable segments of memory. So while you may use a bit less actual memory switching to malloc/free, you could also have less usable memory available.
--Palrich > Ok I have a small question. I've never liked how the mud will take things > like char_data pointers and empty them out and add them to a list. And then > when it needs a new one it just pulls out an old one, and Resets all the > variables. I do understand that they did that cause malloc is a very slow > function code wise. And to save time of constantly allocating things. But > the problem I see is this. On the mud I'm currently overhauling, in it's old > version you were allowed to have unlimited amounts of platinum bars in your > inventory. So we would have players that would have like 300 - 1000 plat > bars on then (obviously an economy system imbalance). Now this will be fixed > in the overhaul. But I was thinking you get 2 players that log on and they > have 1000 plat each. Now when they quit it will put those 2000 plats plus > what ever else that had into this giant list. And now theirs entirely more > memory allocated then really needs to be. So I guess my question is this I > would it really eat all the much cpu time if I had it use new on all new > items and delete, and have it rid itself of some of these large lists of > memory that could be used for other things?

