miloyip's recent timeline updates
miloyip

miloyip

V2EX member #113895, joined on 2015-04-28 13:14:08 +08:00
miloyip's recent replies
Feb 5, 2016
Replied to a topic by iambic 问与答 请问一个 rapidjson 使用问题
RapidJSON 允许一个 Object 内有相同的 Key ,在 `AddMember()` 里不作检查。
`Document` 在 consturctor 中不给与 allocator 的时候,是自行建立一个 allocator 。那么 `Parse()` 的时候会用该 allocator 来分配内存。所以两个 block 的 第一个 block 中的 `Document d2` 在离开 block 时, allocator 会连同其分配的内存同时失效。因此之后 d 里会有 dangling pointer 。
解决方法是让 d2 采用 d 的 allocator :`Document d2(&alloc);`。
About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5745 Online   Highest 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 16ms · UTC 03:10 · PVG 11:10 · LAX 20:10 · JFK 23:10
♥ Do have faith in what you're doing.