Re: [jackson-user] StackOverflowError in deeply nested JSON

2016-07-06 Thread Tatu Saloranta
Thank you!

-+ Tatu +-

On Fri, Jul 1, 2016 at 10:05 AM, Colin White  wrote:

> Thanks for the response. I'll take a closer look into the allocations on
> the stack and report back.
>
> -Colin
>
>
> On Thursday, 30 June 2016 22:33:41 UTC-7, Tatu Saloranta wrote:
>>
>> 50 levels it not a lot, but at the same time, amount of state Jackson
>> keeps should not be big so it is bit puzzling. 32kb/50 gives about 600
>> bytes and I wouldn't think there is that much state kept per level.
>> Generator keeps couple of things (property name, index number, parent
>> reference), serializers also but it really should not add up to anything
>> significant.
>>
>> Jackson-jr is very minimalistic so if this really is proportional to
>> state it should fare bit better (generator is the same). Perhaps worth
>> testing. Maybe write a simple test to see.
>>
>> But all in all it seems odd; unfortunately I don't know what could cause
>> it.
>>
>> -+ Tatu -
>>
>>
>> On Thu, Jun 30, 2016 at 12:28 PM, Colin White 
>> wrote:
>>
>>> I'm trying to serialize a JSON object that represents a conversation
>>> tree. Here's the POJO:
>>>
>>> class Node {
>>> @JsonProperty("children") private List children;
>>> @JsonProperty("text") private String text;}
>>>
>>> Eventually the tree ends with a Node with an empty list of children.
>>>
>>> The problem is: serializing a deep tree (say, 50 nodes deep) causes a
>>> StackOverflowError on Android devices using the Dalvik runtime since it
>>> only has a 32kb stack size.
>>>
>>> Is there any way to avoid using recursion in Jackson? Is there a more
>>> efficient way to represent my POJO? Will migrating to Jackson Jr. help
>>> solve my problems? I'm using Jackson 2.7.5.
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "jackson-user" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to jackson-user...@googlegroups.com.
>>> To post to this group, send email to jackso...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> --
> You received this message because you are subscribed to the Google Groups
> "jackson-user" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to jackson-user+unsubscr...@googlegroups.com.
> To post to this group, send email to jackson-user@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"jackson-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jackson-user+unsubscr...@googlegroups.com.
To post to this group, send email to jackson-user@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [jackson-user] StackOverflowError in deeply nested JSON

2016-07-01 Thread Colin White
Thanks for the response. I'll take a closer look into the allocations on 
the stack and report back.

-Colin


On Thursday, 30 June 2016 22:33:41 UTC-7, Tatu Saloranta wrote:
>
> 50 levels it not a lot, but at the same time, amount of state Jackson 
> keeps should not be big so it is bit puzzling. 32kb/50 gives about 600 
> bytes and I wouldn't think there is that much state kept per level. 
> Generator keeps couple of things (property name, index number, parent 
> reference), serializers also but it really should not add up to anything 
> significant.
>
> Jackson-jr is very minimalistic so if this really is proportional to state 
> it should fare bit better (generator is the same). Perhaps worth testing. 
> Maybe write a simple test to see.
>
> But all in all it seems odd; unfortunately I don't know what could cause 
> it.
>
> -+ Tatu -
>
>
> On Thu, Jun 30, 2016 at 12:28 PM, Colin White  > wrote:
>
>> I'm trying to serialize a JSON object that represents a conversation 
>> tree. Here's the POJO:
>>
>> class Node {
>> @JsonProperty("children") private List children;
>> @JsonProperty("text") private String text;}
>>
>> Eventually the tree ends with a Node with an empty list of children.
>>
>> The problem is: serializing a deep tree (say, 50 nodes deep) causes a 
>> StackOverflowError on Android devices using the Dalvik runtime since it 
>> only has a 32kb stack size.
>>
>> Is there any way to avoid using recursion in Jackson? Is there a more 
>> efficient way to represent my POJO? Will migrating to Jackson Jr. help 
>> solve my problems? I'm using Jackson 2.7.5.
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "jackson-user" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to jackson-user...@googlegroups.com .
>> To post to this group, send email to jackso...@googlegroups.com 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"jackson-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jackson-user+unsubscr...@googlegroups.com.
To post to this group, send email to jackson-user@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[jackson-user] StackOverflowError in deeply nested JSON

2016-06-30 Thread Colin White


I'm trying to serialize a JSON object that represents a conversation tree. 
Here's the POJO:

class Node {
@JsonProperty("children") private List children;
@JsonProperty("text") private String text;}

Eventually the tree ends with a Node with an empty list of children.

The problem is: serializing a deep tree (say, 50 nodes deep) causes a 
StackOverflowError on Android devices using the Dalvik runtime since it 
only has a 32kb stack size.

Is there any way to avoid using recursion in Jackson? Is there a more 
efficient way to represent my POJO? Will migrating to Jackson Jr. help 
solve my problems? I'm using Jackson 2.7.5.

-- 
You received this message because you are subscribed to the Google Groups 
"jackson-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jackson-user+unsubscr...@googlegroups.com.
To post to this group, send email to jackson-user@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.