[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] json-parser: don't replicate tokens at each lev
From: |
Michael Roth |
Subject: |
Re: [Qemu-devel] [PATCH] json-parser: don't replicate tokens at each level of recursion |
Date: |
Mon, 13 Aug 2012 21:30:06 -0500 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Mon, Aug 13, 2012 at 08:49:26PM +0200, Markus Armbruster wrote:
> Michael Roth <address@hidden> writes:
>
> > Currently, when parsing a stream of tokens we make a copy of the token
> > list at the beginning of each level of recursion so that we do not
> > modify the original list in cases where we need to fall back to an
> > earlier state.
> >
> > In the worst case, we will only read 1 or 2 tokens off the list before
> > recursing again, which means an upper bound of roughly N^2 token
> > allocations.
> >
> > For a "reasonably" sized QMP request (in this a QMP representation of
> > cirrus_vga's device state, generated via QIDL, being passed in via
> > qom-set), this caused my 16GB's of memory to be exhausted before any
> > noticeable progress was made by the parser. The command is here for
> > reference, and can be issued against upstream QMP to reproduce (failure
> > occurs before any qmp command routing/execution):
> >
> > http://pastebin.com/mJrZ3Ctg
>
> Commit messages are forever, pastebins aren't.
>
> What about preserving your test case for eternity under tests/?
We might be able to generate some json objects that cause the behavior and add
them to check-qjson.
>
> [...]
>