# US 2018/0321866 A1 · Recursive serialization of a hierarchy of data objects

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2018/0321866 A1
- Document ID: US20180321866A1
- Status: Published application
- Kind: A1
- Application number: 16/037,406
- Filed: 2018-07-17
- Published: 2018-11-08
- Earliest claimed: 2017-04-26
- Assignees: International Business Machines Corporation
- Applicants: International Business Machines Corporation
- Inventors: Timothy P. Ellison; Amit S. Mane; Sathiskumar Palaniappan; Vijay Sundaresan
- Web page: https://patentgrep.com/patent/US20180321866A1

## CPC

- G06F 9/4493: {Object persistence}
- G06F 3/0659: {Command handling arrangements, e.g. command buffers, queues, command scheduling}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A data-serialization system initially uses a recursive serialization algorithm to serialize a hierarchy of nested data objects by translating those objects into a serial stream of data. The system determines that a stack-overflow error is likely to occur whenever the number of objects serialized by the system exceeds a threshold value, or whenever the stack has reached an unacceptable level of utilization. When the system determines that a stack-overflow error is likely or if the system detects that a stack-overflow error will definitely occur if another object is serialized, the system either transfers control to a nonrecursive algorithm that does not require a stack data structure or reduces stack utilization by transferring contents of the stack to a variable-size queue-like data structure.

## Claims

### Claim 1

A data-serialization system comprising a processor, a memory coupled to the processor, and a computer-readable hardware storage device coupled to the processor, the storage device containing program code configured to be run by the processor via the memory to implement a method for dynamic reduction of stack-overflow errors in a recursive data-serialization procedure, the method comprising:
launching the recursive data-serialization procedure to serialize each object of a hierarchy of serializable data objects, where the recursive data-serialization procedure temporarily stores a state of a partially serialized object as a frame of a stack data structure;
determining that a threshold condition has been satisfied,
where the threshold condition is selected,
where the satisfaction of the threshold condition indicates an unacceptable likelihood that the recursive data-serialization procedure will generate a stack-overflow error; and
performing a corrective action in response to the determining,
where the corrective action is capable of preventing the stack-overflow error, and
where the corrective action comprises:
pausing the recursive data-serialization procedure;
deleting data from the stack data structure by popping frames of the stack data structure;
storing the popped frames in a variable-size queue-like data structure; and
resuming, by the recursive data-serialization procedure, serialization of the hierarchy of serializable data objects.

### Claim 2 (depends on 1)

The system of claim 1, where the threshold condition is a determination that a number of objects of the hierarchy that have been serialized by the recursive data-serialization procedure exceeds a threshold value.

### Claim 3 (depends on 1)

The system of claim 1,
where the threshold condition is a determination that a utilization of the stack exceeds a threshold value,
where the hierarchy of serializable data objects is represented as a directed graph, and
where the threshold value is a length of a longest possible path between a root of the directed graph and any leaf of the directed graph.

### Claim 4 (depends on 1)

The system of claim 1, where the threshold condition is a determination that the recursive data-serialization procedure has triggered a stack-overflow error.

### Claim 5 (depends on 1)

The system of claim 1, where the corrective action further comprises:
terminating the recursive data-serialization procedure; and
initiating a nonrecursive data-serialization procedure that resumes serialization of the hierarchy of serializable data objects from the point at which the recursive data-serialization procedure was terminated.

### Claim 6 (depends on 1)

The system of claim 1,
where each object is capable of comprising at least one field,
where each field of the at least one field is either a primitive field or a reference field,
where a primitive field stores a value,
where a reference field of a parent object of the hierarchy identifies another object of the hierarchy, and
where the another object is organized within the hierarchy as a child of the reference field.

### Claim 7 (depends on 1)

The system of claim 1, where a first object of the hierarchy is an instance of an object class and where each field comprised by the first object is capable of being a subclass of the object class.

### Claim 8

A method for dynamic reduction of stack-overflow errors in a recursive data-serialization procedure, the method comprising:
launching the recursive data-serialization procedure to serialize each object of a hierarchy of serializable data objects, where the recursive data-serialization procedure temporarily stores a state of a partially serialized object as a frame of a stack data structure;
determining that a threshold condition has been satisfied,
where the threshold condition is selected,
where the satisfaction of the threshold condition indicates an unacceptable likelihood that the recursive data-serialization procedure will generate a stack-overflow error; and
performing a corrective action in response to the determining,
where the corrective action is capable of preventing the stack-overflow error, and
where the corrective action comprises:
pausing the recursive data-serialization procedure;
deleting data from the stack data structure by popping frames of the stack data structure;
storing the popped frames in a variable-size queue-like data structure; and
resuming, by the recursive data-serialization procedure, serialization of the hierarchy of serializable data objects.

### Claim 9 (depends on 8)

The method of claim 8, where the threshold condition is a determination that a number of objects of the hierarchy that have been serialized by the recursive data-serialization procedure exceeds a threshold value.

### Claim 10 (depends on 8)

The method of claim 8,
where the threshold condition is a determination that a utilization of the stack exceeds a threshold value,
where the hierarchy of serializable data objects is represented as a directed graph, and
where the threshold value is a length of a longest possible path between a root of the directed graph and any leaf of the directed graph.

### Claim 11 (depends on 8)

The method of claim 8, where the threshold condition is a determination that the recursive data-serialization procedure has triggered a stack-overflow error.

### Claim 12 (depends on 8)

The method of claim 8, where the corrective action further comprises:
terminating the recursive data-serialization procedure; and
initiating a nonrecursive data-serialization procedure that resumes serialization of the hierarchy of serializable data objects from the point at which the recursive data-serialization procedure was terminated.

### Claim 13 (depends on 8)

The method of claim 8,
where each object is capable of comprising at least one field,
where each field of the at least one field is either a primitive field or a reference field,
where a primitive field stores a value,
where a reference field of a parent object of the hierarchy identifies another object of the hierarchy, and
where the another object is organized within the hierarchy as a child of the reference field.

### Claim 14 (depends on 8)

The method of claim 8, further comprising providing at least one support service for at least one of creating, integrating, hosting, maintaining, and deploying computer-readable program code in the computer system, wherein the computer-readable program code in combination with the computer system is configured to implement the launching, the determining, and the performing.

### Claim 15

A computer program product, comprising a computer-readable hardware storage device having a computer-readable program code stored therein, the program code configured to be executed by a data-serialization system comprising a processor, a memory coupled to the processor, and a computer-readable hardware storage device coupled to the processor, the storage device containing program code configured to be run by the processor via the memory to implement a method for dynamic reduction of stack-overflow errors in a recursive data-serialization procedure, the method comprising:
launching the recursive data-serialization procedure to serialize each object of a hierarchy of serializable data objects, where the recursive data-serialization procedure temporarily stores a state of a partially serialized object as a frame of a stack data structure;
determining that a threshold condition has been satisfied,
where the threshold condition is selected,
where the satisfaction of the threshold condition indicates an unacceptable likelihood that the recursive data-serialization procedure will generate a stack-overflow error; and
performing a corrective action in response to the determining,
where the corrective action is capable of preventing the stack-overflow error, and
where the corrective action comprises:
pausing the recursive data-serialization procedure;
deleting data from the stack data structure by popping frames of the stack data structure;
storing the popped frames in a variable-size queue-like data structure; and
resuming, by the recursive data-serialization procedure, serialization of the hierarchy of serializable data objects.

### Claim 16 (depends on 15)

The computer program product of claim 15, where the threshold condition is a determination that a number of objects of the hierarchy that have been serialized by the recursive data-serialization procedure exceeds a threshold value.

### Claim 17 (depends on 15)

The computer program product of claim 15,
where the threshold condition is a determination that a utilization of the stack exceeds a threshold value,
where the hierarchy of serializable data objects is represented as a directed graph, and
where the threshold value is a length of a longest possible path between a root of the directed graph and any leaf of the directed graph.

### Claim 18 (depends on 15)

The computer program product of claim 15, where the threshold condition is a determination that the recursive data-serialization procedure has triggered a stack-overflow error.

### Claim 19 (depends on 15)

The computer program product of claim 15, where the corrective action further comprises:
terminating the recursive data-serialization procedure; and
initiating a nonrecursive data-serialization procedure that resumes serialization of the hierarchy of serializable data objects from the point at which the recursive data-serialization procedure was terminated.

### Claim 20 (depends on 15)

The computer program product of claim 15,
where each object is capable of comprising at least one field,
where each field of the at least one field is either a primitive field or a reference field,
where a primitive field stores a value,
where a reference field of a parent object of the hierarchy identifies another object of the hierarchy, and
where the another object is organized within the hierarchy as a child of the reference field.
