RE: TK_mem problem and replacement
- Posted by jordah ferguson <jorfergie03 at yahoo.com> Jun 24, 2002
- 387 views
Matthew Lewis wrote: > > > -----Original Message----- > > From: jordah ferguson [mailto:jorfergie03 at yahoo.com] > > > B4, you read this, i have written a tk_mem.e replacement but > > using pure > > euphoria code. It is fast and is still undergoing a series of > > tests. It > > is safer and faster than the original tk_mem. Soon to be > > released on RDS > > One of the reasons tk_mem was written was to use the memory management > of > windows, which has the capability to return RAM to the OS when you're > done > with it. Matt, are you saying EU cannot natively do this? Fill me in as i find my code working for all examples. If EU cannot natively do this then we should talk to ROB about this! > > > -- What if you are allocating a Byte,Strz or Word? They would still be > > -- forced to take 4 bytes of memory with below code > > You're going to always allocate 4 bytes (even if you only ask for 1). > Everything is 4-byte aligned. > > > If Yes, pData should be a minimum of 4 Bytes. Why bother with > > > > if pData != 0 then > > pData = vSizeLengs[pData] > > end if > > Here, pData is originally an index into vSizeLengs. Derek then makes > sure > that you're asking for at least 4 bytes (you might have wanted more). I > suspect that he's left this in just in case he ever codes in a datatype > with > more than 4 bytes. Then, he only needs to add it to > vSizeNames/vSizeLengs. > It might be appropriate to return an error if pData = 0, since this > indicates that the user specified an unknown datatype. > > Matt Lewis > Matt, i once read a post from Bernie Ryan, when he said that evry time win32lib crashed, garbage would be left in the OS memory. My TK_mem just uses EU calls to simulate msets... which incase win32lib crashed EU would still free the memory. This is for people who have computers with litter MEM. jordah ferguson Sir LoJik > >