lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Thanks everyone for your replies, it's very enlightening! One thing I forgot
to tell everyone is that I'm using dlmalloc, and after a bit of tweaking
works a treat. Strangely enough, before I implemented it, I used the
"native" malloc on this particular console, and the profile information
suggested it was the same algorithm.

> View memory as a stack, and forbid freeing anything until everything
> that was allocated after it has been freed.  You can be a bit more
> flexible than that - use a stack of states, and insist that each state
> frees all of the memory it allocated before it leaves.

That's the sort of approach my boss wants to take. I'm under the impression
that it's not going to be that simple. However, he wants this scripting
system to last for a good few games, so spending time now making it as
robust as possible is going to pay off. Any hints on how I might go about
this?

> I suppose you could force a collection on each state transition.  That
> might work.  You still need discipline, of course.  And a big stick. 

The thing is, I'd probably be the only person being beaten with that stick!
I have enough of that at the weekends (I'm a member of a Viking and
Anglo-Saxon reenactment group, nothing kinky)!

> Whichever language you use, patch its memory allocation 
> routines so you
> can produce a log of all allocation: where, how much, and who did it.
> We have an off-line graphical viewer that nicely shows where 
> fragmentation
> occurs, and who to blame.  It's much easier to do this in Lua than in
> C++.

That's pretty much what I'm doing at the moment. I'm just using .csv files
and Excel at the moment.

> You mean spend CPU time on something that's not directly related to
> the game?  Heresy! :-)

LOL! This is true. Especially as it may occur at any time during the game,
and take an indeterminate amount of time. Dropping frames at random
intervals is A Bad Thing on a console. Of course the graphics guys get all
the time they want, and the sound guys have a completely separate chip to
play around with *mumble mumble* :)

John Donovan
Programmer - Magenta Software Ltd.


The content of this message and any attached file are confidential and/or
privileged and are for the intended recipient only. If you are not the
intended recipient, any unauthorised use, disclosure, copying, distribution
or other dissemination is strictly prohibited. If you receive this message
in error please notify the sender immediately by email, telephone or fax and
then delete this email. Any attachment with this message should be checked
for viruses before it is opened.  Magenta Software Limited cannot be held
responsible for any failure by the recipient to check for viruses before
opening any attachment. Copyright in this email and attachments created by
us belongs to Magenta Software Limited. Should you communicate with anyone
at Magenta Software Limited by email you consent to us monitoring and
reading any such correspondence.