Search code examples
performancesymfonyweb-servicesmemory-managementservice

What happen if inject too many services in a service ??? memory perpective?


I have a service where I inject too many services (10-15) in Symfony framework (I don't think so framework matter).

  • I know it will have an impact on performance but want to answer in detail how ???
  • What happens behind the scene, means memory perspective. ???

Solution

  • There are multiple service injection types and they all come with advantages/disadvantages. If you're talking about optional dependencies, setter injection could be an approach.