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 


<<Failure allocating memory near 140846476>> err

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

Joined: 06 Dec 2019
Posts: 41

PostPosted: Fri Aug 27, 2021 5:12 pm    Post subject: <<Failure allocating memory near 140846476>> err Reply with quote

i got this error when I try to activate my script (in this 64-bit game im playing [Final Fantasy XV]) but it doesn't always happen. it happens sometimes, but still often. i've noticed it after i messed around with kernel settings. hopefully dark byte will come to the rescue and shed some light on this. Well, I stopped getting this error for a while, but now it's back. And i don't know what/how i fixed it lol. but a person i know in the discord is still having this issue. we would like to get to the bottom of this.

Last edited by themandem on Fri Aug 27, 2021 9:24 pm; edited 2 times in total
Back to top
View user's profile Send private message
LeFiXER
Grandmaster Cheater Supreme
Reputation: 20

Joined: 02 Sep 2011
Posts: 1072
Location: 0x90

PostPosted: Fri Aug 27, 2021 5:57 pm    Post subject: Reply with quote

Can you show your script?
Back to top
View user's profile Send private message
themandem
Cheater
Reputation: 0

Joined: 06 Dec 2019
Posts: 41

PostPosted: Fri Aug 27, 2021 6:48 pm    Post subject: Reply with quote

LeFiXER wrote:
Can you show your script?


i have several scripts and i don't think anything is wrong with any of them because i didn't change them at all and they were working before (when I tried activating them one at a time). but now that I'm trying to activate all of them, i'm having this issue. Here's one...also know that my script looks different than your regular script because its a 64 bit game and i needed to use PeaceBeUponU's absolute jump template which is a fix for these far jumps the game keeps making whenever i inject code in it.

Like i said before. sometimes they activate. often they don't recently. and i haven't changed the scripts. usually it happens when i try to activate too many scripts at a time...or well sometimes none of them would activate...

Code:
[ENABLE]
  //Template Author = PeaceBeUponYou

aobscanmodule(health1,ffxv_s.exe,8B 83 A0 01 00 00 2B) // should be unique
alloc(newmem,$1000,health1)
label(code)
label(return)
label(playerHealth)
label(enemyHealth)
label(infhealth)
label(infhealth_flag)
label(ohk)
label(ohk_flag)
registersymbol(infhealth_flag)
registersymbol(ohk_flag)
registersymbol(playerHealth)
registersymbol(enemyHealth)

newmem:
  pop rax
  //Write your code here:
  cmp [rbx+180],#257         //player check
  je infhealth
  cmp [ohk_flag],1
  je ohk
  jmp code

infhealth:
  cmp [infhealth_flag],0
  je code
  mov eax,[rbx+000001A4]     // move health cap into eax which then later goes into current health
  //sub eax,[rdx]            // remove this or else it'll interfere with infinite health/make it wonky
  mov ecx,[rbx+000001A4]
    // ^original code from 13 bytes long jump

  push rax                  // injection copy
  lea rax,[rbx+1A0]
  mov [playerHealth],rax
  pop rax
  jmp return

code:
  //readmem(health1,14)
  push rax                  // injection copy
  lea rax,[rbx+1A0]
  mov [enemyHealth],rax
  pop rax

  mov eax,[rbx+000001A0]     //original code
  sub eax,[rdx]
  mov ecx,[rbx+000001A4]
  jmp return

ohk:
  push rax                  // injection copy
  lea rax,[rbx+1A0]
  mov [enemyHealth],rax
  pop rax

  mov eax,0
    //  sub eax,[rdx]        // no need
  mov ecx,[rbx+000001A4]
    // ^original code from 13 bytes long jump
  jmp return

playerHealth:
  dq 0
enemyHealth:
  dq 0
infhealth_flag:
  dd 0
ohk_flag:
  dd 0

health1:
  push rax
  mov rax,newmem
  jmp rax
  nop
  return:
registersymbol(health1)

[DISABLE]

health1:
  db 8B 83 A0 01 00 00 2B 02 8B 8B A4 01 00 00

unregistersymbol(health1)
unregistersymbol(infhealth_flag)
unregistersymbol(ohk_flag)
unregistersymbol(playerHealth)
unregistersymbol(enemyHealth)
dealloc(newmem)


Last edited by themandem on Sat Aug 28, 2021 8:09 pm; edited 1 time in total
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 475

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

PostPosted: Sat Aug 28, 2021 1:51 am    Post subject: Reply with quote

make sure kernelmode querymemoryregions is disabled in settings

if that's not it, remove the 3th alloc parameter and use a 14 byte jmp

it looks like this script already assumes a 14 byte jmp, so you're safe to remove the 3th alloc parameter

_________________
Tools give you results. Knowledge gives you control.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
themandem
Cheater
Reputation: 0

Joined: 06 Dec 2019
Posts: 41

PostPosted: Sat Aug 28, 2021 7:02 pm    Post subject: Reply with quote

Dark Byte wrote:
make sure kernelmode querymemoryregions is disabled in settings

if that's not it, remove the 3th alloc parameter and use a 14 byte jmp

it looks like this script already assumes a 14 byte jmp, so you're safe to remove the 3th alloc parameter


thank you yes, removing the 3rd alloc parameter fixed it!
Back to top
View user's profile Send private message
zwangxian
How do I cheat?
Reputation: 0

Joined: 20 May 2014
Posts: 9

PostPosted: Mon Jan 24, 2022 12:31 am    Post subject: Reply with quote

Dark Byte wrote:
make sure kernelmode querymemoryregions is disabled in settings

if that's not it, remove the 3th alloc parameter and use a 14 byte jmp

it looks like this script already assumes a 14 byte jmp, so you're safe to remove the 3th alloc parameter


Sorry for digging this out, but I met the exact same problem of failure allocating memory near ***. It happens 5 out of 10 times. Sometimes it's this script and sometimes it's that one, and I didn't change anything at all. My kernel query memory option is off all the time.

I noticed adding the 3rd parameter makes the newmem allocated exactly 0xA0000 bytes after the aobscan location, which sometimes might not be in a writable memory block, but even if it IS writable, this still happens. I've tried removing the 3rd parameter, but scripts like this crash the game a lot after activation. With the 3rd parameter, the scripts either function perfectly or failure allocting memory. It won't crash the game at least. So why is that happening? And how is a 14 byte jmp different than a direct location jmp?
Back to top
View user's profile Send private message Send e-mail
Dark Byte
Site Admin
Reputation: 475

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

PostPosted: Mon Jan 24, 2022 3:14 am    Post subject: Reply with quote

It means that sometimes there's no memory free with the requested size within 2GB of the given address

Some programs just take up a lot of memory, and others reserve the memory for later making it impossible to allocate nearby.

a 5 byte jmp can only jump a distance of 2GB, so that means that these are unreliable or just wont work.

So the only solution is to use a 14 byte jmp (you could do 12 if you know you can sacrifice a register, or 13 but your destination has to pop a register back)


Tip: If you're using templates to build your script, hold down CTRL and then use the template to generate the code. It will generate a script that uses 14 byte jmps so you don't have to bother with that (too much, you still need to make sure it's not the destination of a relative jmp)

_________________
Tools give you results. Knowledge gives you control.

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