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 


D3DHook_FontMap.changeFont Memory Leak

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
L0rd_Yoshi
How do I cheat?
Reputation: 0

Joined: 24 May 2020
Posts: 2

PostPosted: Sun Jul 12, 2020 1:35 am    Post subject: D3DHook_FontMap.changeFont Memory Leak Reply with quote

Hi, I'm running CE 7.1, and I needed a way to update the font size of D3Dhook_TextContainer objects, so my initial idea was to update the font map every frame. Unfortunately, the only way to change the text size of font map objects is to adjust a font object and use D3DHook_FontMap.changeFont, which appears to have a nasty memory leak. I could just compare the window size to a stored variable and update it then, but I was wondering if there was an undocumented alternate way of changing the font size. Thanks.

The below code will consume about 400MB extra process memory.
Code:
d3dobj = createD3DHook()
testfont = createFont()
testfontmap = d3dobj.createFontmap(testfont)
for i = 1, 10000 do
    testfontmap.changeFont(testfont)
end
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 471

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

PostPosted: Sun Jul 12, 2020 2:22 am    Post subject: Reply with quote

You can have more than 1 fontmap

Create 4 to 5 fontmaps and then assign them to the textcontainer as needed. No need to create a new fontmap each time

And if that doesn't work then create 4 to 5 textcontainers each with their unique fontmap. Then when you wish to change the size hide the old one and make the others invisible

_________________
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
L0rd_Yoshi
How do I cheat?
Reputation: 0

Joined: 24 May 2020
Posts: 2

PostPosted: Sun Jul 12, 2020 10:58 am    Post subject: Reply with quote

I tried to D3DHook_FontMap.destroy() the previous font map and create a new font map, but D3DHOOK.createFontmap() also has memory leaks. D3Dhook_TextContainer.FontMap() does not have any leaks, so creating several text containers with different font sizes could work depending on how many different text profiles are needed. I will go with my solution of detecting a window size change and updating it then. Thanks.
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 Lua Scripting 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