Skip to content
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

No output for large alloc files #2

Open
TWiStErRob opened this issue Jul 11, 2016 · 1 comment
Open

No output for large alloc files #2

TWiStErRob opened this issue Jul 11, 2016 · 1 comment

Comments

@TWiStErRob
Copy link

TWiStErRob commented Jul 11, 2016

apat allocs list com.bumptech.glide.supportapp.v3_2016.03.19_12.54.alloc prints nothing.
You can find the file at https://code.google.com/p/android/issues/detail?id=204503

The file is 8MB large, and contains 65536 allocations, but as detailed in a comment on the above issue the AllocationsParser can't handle that. I suggest that you implement your own parser the only trick you need is to have a package private constructor accessor for AllocationInfo. Alternatively you can modify the input file in this edge case (though this will miss 1 allocation):

public class AllocationsParserAdapter {
public static List<AllocRow> parse(ByteBuffer data) {
    byte messageHdrLen = data.get(0);
    int numEntries = data.getShort(1 + 1 + 1) & 0xffff;
    if (numEntries == 0 && messageHdrLen < data.capacity()) {
        ByteBuffer clone = ByteBuffer.allocate(data.capacity());
        data.rewind();
        clone.put(data);
        data = clone;
        data.putShort(1 + 1 + 1, (short) 65535); // 3rd position (0 based) is after 3 one-byte header fields
        data.rewind();
    }
    AllocationInfo[] orig = AllocationsParser.parse(data);
@TWiStErRob
Copy link
Author

Google decided it's not worth supporting their "old" buggy platforms (pre-L) in their official IDE, so ddmlib won't be fixed. If you want to handle these you'll have to do the above trick or write your own AllocationsParser.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant