schmittjoh / serializer

Library for (de-)serializing data of any complexity (supports JSON, and XML)
http://jmsyst.com/libs/serializer
MIT License
2.32k stars 585 forks source link

PoC - fix memory leaks #1434

Closed scyzoryck closed 1 year ago

scyzoryck commented 2 years ago
Q A
Bug fix? yes
New feature? no
Doc updated not yet
BC breaks? yes
Deprecations? no
Tests pass? not yet
Fixed tickets https://github.com/schmittjoh/serializer/pull/1431 https://github.com/schmittjoh/JMSSerializerBundle/issues/895
License MIT

PoC of fixing circular references. Any feedback will be appreciated. It contains braking changes.

To do:

Before

+---------------------+----------+
| benchmark           | mem_peak |
+---------------------+----------+
| XmlMutlipleRunBench | 38.158mb |
| XmlSingleRunBench   | 3.794mb  |
+---------------------+----------+
classDiagram
class Context {
    +VisitorInterface $visitor
    +GraphNavigatorInterface $navigator
}

class GraphNavigator {
    +VisitorInterface $visitor
    +Context $context
}

class AbstractVisitor {
    +GraphNavigatorInterface $navigator
}

GraphNavigator ..> Context
AbstractVisitor ..> Context

AbstractVisitor ..> GraphNavigator
Context ..> GraphNavigator

GraphNavigator ..> AbstractVisitor

After

+---------------------+----------+
| benchmark           | mem_peak |
+---------------------+----------+
| XmlMutlipleRunBench | 3.274mb  |
| XmlSingleRunBench   | 3.272mb  |
+---------------------+----------+
classDiagram
class Context {
    +VisitorInterface $visitor
}

class GraphNavigator {
    +Context $context
}

class AbstractVisitor

AbstractVisitor ..> Context

Context ..> GraphNavigator
scyzoryck commented 1 year ago

Closed for now in favor of https://github.com/schmittjoh/serializer/pull/1473