[PATCH] D61599: [Support] MemoryBlock objects now expose their allocated size in addition to the requested size.

Andrew Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 8 02:59:24 PDT 2019


andrewng added a comment.

In D61599#1493926 <https://reviews.llvm.org/D61599#1493926>, @mvhooren wrote:

> In D61599#1493889 <https://reviews.llvm.org/D61599#1493889>, @lhames wrote:
>
> > I don't think this is the right solution. MemoryBlock's purpose is to track the allocated memory. What the client does with that memory (including subdividing it) is their business. The client already knows the number of bytes they're requesting, so the fix for fragmentation in SectionMemoryManager should be limited to fixes in SectionMemoryManager.
>
>
> Yes I agree it would be better if the Size member of MemoryBlock just held the allocated size. This would mean that r357058 and r351916 (and perhaps others) should be reverted.


By making the Size member be the allocated rather than the requested size effectively reverts those two revisions. To address the issue that r357058 and r351916 fixed, you will need to change the class InMemoryBuffer in FileOutputBuffer.cpp to itself track the requested size rather than use the allocated size from MemoryBlock.

This does seem to be the better solution, given the interface and other usages of MemoryBlock. When I made the change in r357058, I just mirrored the change in r351916, assuming that was the appropriate approach.

Cheers,
Andrew


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D61599/new/

https://reviews.llvm.org/D61599





More information about the llvm-commits mailing list