So it's better to have it allocate and free as little as possiable, when doing something that is as freeed and allocated as char_data structs and obj_data structs? I'm still really new to memory allocations. It just seemed to me kinda pointless to keep all these pointers around if they weren't going to be used. But I could see where it could cause small problems *grins* esp if it were windows.
----- Original Message ----- From: "Michael Barton" <[EMAIL PROTECTED]> To: "Dale Kingston" <[EMAIL PROTECTED]>; "ROM" <[email protected]> Sent: Friday, November 15, 2002 12:50 AM Subject: Re: Memory allocations and cpu ussage question. > 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? > > > -- > ROM mailing list > [email protected] > http://www.rom.org/cgi-bin/mailman/listinfo/rom >

