Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Excessive memory allocation for primitive arrays in nested resultmaps #927
When mapping a result using a resultmap that contains a
See this repository for a reproduction. The root of the allocation is the
This logic in CacheKey was introduced in this commit to solve #124 and #125. Arrays use object identity rather than considering they contents for
The attached commit achieves the content based
Hi @simplyarjen ,
Thank you for the report and the demo app!
I have fixed it slightly differently (uses java.util.Arrays methods, but no wrappers).
Note that cause of this issue is one of the disadvantages brought by omitting
Even without this fix, the demo app runs fine if id elements are added to the result map.
<resultMap id="FileMap" type="co.rngd.mybatis.File"> <id column="id" /> <result property="content" column="data" /> <association property="metadata" resultMap="MetadataMap" /> </resultMap> <resultMap id="MetadataMap" type="co.rngd.mybatis.Metadata"> <id column="id" /> <result property="name" column="name" /> <result property="sizeInBytes" column="size" /> </resultMap>
As the target objects do not have 'id' fields, there is no 'property' attribute in