Changes to TNeonDeserializerJSON.ReadArray to repair MemoryLeak to Array Class #76
Stefan1286b
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello.
I have some changes to TNeonDeserializerJSON.ReadArray
When I have an Object to deserialize which has a field that is an ARRAY OF (Class inherited from TObject) then in the actual Version.
The inherited objects are removed from the array but not freed. And new inherited Objects are created.
That a Memory Leak.
There is a comment
But I don't underständ why we don't need to free it.
I have change it in my version, it will only free if Config.AutoCreate and the JSON Array is smaller then the object array.
If Config.AutoCreate and JSON Array is greater then the Object Array grow up und the Object will be automaically created by:
ReadDataMember(LItemParam, LItemValue, True) -> ReadReference(AParam, AData) -> ManageInstance(AParam.JSONValue, AData, AParam.NeonObject) -> TRttiUtils.CreateInstance(LType)
I tested some situations and all works fine.
Here is my code:
Hope you like it.
with best regards.
Sorry for my english
Who finds spelling mistakes may keep them.
Beta Was this translation helpful? Give feedback.
All reactions