lua-users home
lua-l archive

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


 


> Enrico Colombini
> Wouldn't it be better to do nothing and just return 'block' 
> if (size <=
> oldsize) ?


Hi Enrico,

It depends on your definition of 'better' ;) (i.e. whether you're after
speed or minimal memory usage).  It also depends on your particular
usage patterns.  If you had blocks that became very large and then
shrank to become very small, you might end up using a lot more memory
than you need.

It's certainly worth trying the memcpy+malloc+free listed earlier.  Then
measure it and see if it's actually a problem on your particular setup.
The couple of times I've done this, it has turned out to be negligable.

Peter Pimley

__________________________________________________________________________________________________________________________________________
Information contained in this e-mail is intended for the use of the addressee only, and is confidential and may be the subject of Legal Professional Privilege.  Any dissemination, distribution, copying or use of this communication without prior permission of the addressee is strictly prohibited.The views of the author may not necessarily constitute the views of Kuju Entertainment Ltd. Nothing in this email shall bind Kuju Entertainment Ltd in any contract or obligation.

The contents of an attachment to this e-mail may contain software viruses which could damage your own computer system. While Kuju Entertainment has taken every reasonable precaution to minimise this risk, we cannot accept liability for any damage which you sustain as a result of software viruses. You should carry out your own virus checks before opening the attachment.

Kuju Entertainment Ltd trading as Zoe Mode

Registered Office : 10 Woodside Park, Catteshall Lane, Godalming, Surrey, UK, GU7 1LG. Company Number : 3481384. Company Registered in England.
__________________________________________________________________________________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
_________________________________________________________________________________________________________________________________________