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 


Alloc and Dealloc

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
Noobrzor
Advanced Cheater
Reputation: 0

Joined: 19 May 2014
Posts: 74

PostPosted: Fri Aug 21, 2015 8:19 am    Post subject: Alloc and Dealloc Reply with quote

Greetings

I am puzzled about this, I'd appreciate some clarification.

Hypothetical situation and hypothetical AAscript:
Code:
[ENABLE]
alloc(newmem,2048)

game.exe+fffff:
mov eax,ebx

[DISABLE]
game.exe+fffff:
mov ebx,eax


1. If I'd repeatedly enable and disable the script, does a new chunk of memory get allocated every time? So after a while (hypothetically) I might end up with thousands of 'newmem's' eating up my memory/disc space?

I wondered about this since the dawn of my adCEnture, so I always added "dealloc(newmem)" at the DISABLE part.

2. I'd been wondering about same-name labels and 'newmems' within several different AAscripts, and how do they intermingle together. Is that a world's biggest ouchie to have same "newmem" and "exampleLabel" in several different AAscripts, being created and used differently each time?

If I'd have two AAscripts, one with alloc(newmem1,2048) and second with alloc(newmem2,2048) as well as dealloc(newmem1), would activating them consecutively disable the first AAscript by stripping away the memory?

If I'd have two AAscripts, both with same "alloc(newmem,2048)", how does the code know to which one of "newmems'" jump to? If both AAScripts are activated, then there are two newmems, no?

Thank you for your time!
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 457

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

PostPosted: Fri Aug 21, 2015 8:26 am    Post subject: Reply with quote

1: Yes. without dealloc at disable you'll keep on allocating a new block each time

If you use globalalloc(newmem,2048) though, it'll only allocate it once. (Note that other scripts may not use that name then, else they get the same memory)

2:
alloc and regular labels are "local" symbols. As long as you don't register them (e.g registersymbol) they stay local.

disable has a list of alloc'ed locals, which is why it is capable of deallocating it.
(in fact, disable will ONLY deallocate the memory if all it's alloc's have been reported as dealloc, else it won't deallocate any)

_________________
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
Noobrzor
Advanced Cheater
Reputation: 0

Joined: 19 May 2014
Posts: 74

PostPosted: Fri Aug 21, 2015 9:23 am    Post subject: Reply with quote

Thank you, sir.

I shall do my best to absorb your answer.
Back to top
View user's profile Send private message
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