Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Assembly Memory Deallocation in Lua

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4700

PostPosted: Thu Oct 29, 2015 3:18 pm    Post subject: Assembly Memory Deallocation in Lua Reply with quote

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:
Code:
[ENABLE]
alloc(newmem2,1024)
registersymbol(newmem2)

[DISABLE]
dealloc(newmem2)
unregistersymbol(newmem2)

When it's disabled, newmem2 is unregistered, and the address where it was at is filled with ??.

Am I doing something stupid in the Lua script, or is this a bug?

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

Joined: 09 May 2003
Posts: 25788
Location: The netherlands

PostPosted: Thu Oct 29, 2015 3:34 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites