Posted: Thu Oct 29, 2015 3:18 pm Post subject: Assembly Memory Deallocation in Lua
When using autoAssemble(String) in Lua, I can't seem to deallocate memory via dealloc(). Here's an example:
Code:
function allocMem()
autoAssemble([[
alloc(newmem,1024)
registersymbol(newmem)
]])
end
function deallocMem()
autoAssemble([[
dealloc(newmem)
unregistersymbol(newmem)
]])
end
When I call allocMem(), it does everything just fine. I can go into memory view and look at the memory it allocated. But, when I call deallocMem(), it unregisters the symbol "newmem", but it doesn't actually deallocate the memory (the address where newmem was is still filled with 00).
In a similar AA script, this code works just fine:
Joined: 09 May 2003 Posts: 25788 Location: The netherlands
Posted: Thu Oct 29, 2015 3:34 pm Post subject:
Not a bug. Autoassembler dealloc only works in table entries. (And only if all allocs of the enable section have been specified, else nothing will be freed)
Lua scripts don't have a list of all the allocs, so it can't pass that to the disable section (it doesn't even have the option to tell it to run the disable part)
If this is an issue, try globalalloc so you don't constantly allocate a new block, or use the addresslist, add an entry with the script and activate/deactivate that _________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum