TK_mem problem and replacement

new topic     » topic index » view thread      » older message » newer message

Hi Derek,


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


I was Checking tk_mem.e code and found out something rather unusual in 
acquire_mem,
here check out this code. 

constant vSizeNames = {Byte, Word, Long, Lpsz, Hndl, HndlAddr, Strz}
constant vSizeLengs = {   1,    2,    4,    4,    4,        4,    1}

--** START: FROM ACQUIRE_MEM()

        -- Check for special datatype "names"
        if pData < 0 then
            pData = find(pData, vSizeNames)
            if pData != 0 then
                pData = vSizeLengs[pData]
            end if
        end if
--### Problem!!! Below
-- What if you are allocating a Byte,Strz or Word? They would still be
-- forced to take 4 bytes of memory with below code 

        if pData < 4 then
          pData = 4
        end if

--** END: FROM ACQUIRE_MEM()

If Yes, pData should be a minimum of 4 Bytes. Why bother with

            if pData != 0 then
                pData = vSizeLengs[pData]
            end if

Derek, PLease check on this and i hope, It doesn't cause any problems.

Cheers,
Jordah Ferguson
aka Sir LoJiK

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu