-
Notifications
You must be signed in to change notification settings - Fork 83
[FIX] Fix class name parsing for some objects #271
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: experimental
Are you sure you want to change the base?
Conversation
f1f8ace to
03bbe5b
Compare
03bbe5b to
8464978
Compare
EliteMasterEric
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since I fixed TObject to return String, the only thing this PR does is provide some caching for certain known types, right? What do you mean by TObject sometimes being a class type?
8464978 to
865bebf
Compare
Yeah, I guess. All the cache is for is to store the names of classes returned by |
Perfect, that was exactly what I was confused about. I thought the whole ordeal of using |
Co-authored-by: Kolo <67389779+KoloInDaCrib@users.noreply.github.com>
865bebf to
cb3e087
Compare

Note
This PR now fixes some class types getting parsed to "Object" as if they were anonymous structures. You can still check out the original description below.
Original Description
polymod/polymod/hscript/_internal/PolymodInterpEx.hx
Lines 1124 to 1125 in 7f82ddb
This snippet will convert any object to a string; some anon structures can contain string maps in them which will allocate memory when those are converted to strings when getting or setting a value. One a lot of mods seem to reference is
FlxG.save.datawhich can contain a lot of string maps, causing very frequent memory allocations.memory-leaky.mp4
Since a TObject can be either a class type or a struct I was compelled to either:
Type.getClassName(which is apparently slow even though all it does is access a field behind the scenes? Not saying it is, I just heard it from someone)I decided to go with the second since
getClassNamehas so much hatred. I haven't had the chance to test it thoroughly but testing the blacklist ofFlxSave.resolveFlixelClasses(static) andFlxSave.data(instance) and both worked, and the memory leak disappeared.