Memory Leak Problem

UI Components for JSF
Post Reply
tecgurus
Posts: 11
Joined: 04 Sep 2013, 04:44

25 Mar 2020, 20:04

Hello everyone, I hope someone can help me, integrate Spring Boot and primefaces I am using the @Named and @ViewScoped annotation the problem I am having is that the controllers (managedbeans) are not being removed from memory, even if I change the user to different Pages, the instances (objects) of each controller are running out of memory causing the server to become very slow, does anyone have any idea why this is happening? Or how can I eliminate those beans that are no longer being used?

Thanks so much

christophs78
Posts: 30
Joined: 01 Mar 2018, 12:29

25 Mar 2020, 22:04

You use Spring aus DI-Framework instead of CDI?
That´s what we do in our organisation. And this should work without memory leaks.

Do you use Spring or CDI - Annotations? (You need the Spring-Annotations.)

When necessary i can look into our codebase tomorrow and give you some hints?

You already use die Spring-EL-Resolver?

Melloware
Posts: 1780
Joined: 22 Apr 2013, 15:48

25 Mar 2020, 23:27

have you tried to limit the number of ViewScoped beans in web.xml

Mojarra:

Code: Select all

<!-- reduce saved view states -->
<context-param>
    <param-name>com.sun.faces.numberOfViewsInSession</param-name>
    <param-value>15</param-value>
</context-param>
MyFaces:

Code: Select all

<!-- reduce saved view states -->
<context-param>
    <param-name>org.apache.myfaces.NUMBER_OF_VIEWS_IN_SESSION</param-name>
    <param-value>15</param-value>
</context-param>
That will force the 16th one out of memory.
PrimeFaces Developer | PrimeFaces Extensions Developer
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 8.0.1 / PF Extensions 8.0.2

kukeltje
Expert Member
Posts: 9564
Joined: 17 Jun 2010, 13:34
Location: Netherlands

26 Mar 2020, 19:13

Check the omnifaces viewscoped annotation feature some info there as well. And did you check **what** you store in the viewscoped? Is it big?

tecgurus
Posts: 11
Joined: 04 Sep 2013, 04:44

30 Mar 2020, 07:46

I'm using Spring Boot with Joinfaces

In managedbeans i'm using @Named and @ViewScoped (this instances never are destroyer, the instance are acumulated and the application slow until restart the application)

Service and data layer (Spring Annotations)
@Autowired @Service and @Repository (all of this are singleton without problem)

tecgurus
Posts: 11
Joined: 04 Sep 2013, 04:44

30 Mar 2020, 07:47

christophs78 wrote:
25 Mar 2020, 22:04
You use Spring aus DI-Framework instead of CDI?
That´s what we do in our organisation. And this should work without memory leaks.

Do you use Spring or CDI - Annotations? (You need the Spring-Annotations.)

When necessary i can look into our codebase tomorrow and give you some hints?

You already use die Spring-EL-Resolver?
Your help is appreciate it... Please help me i'm using Spring Boot with Joinfaces

tecgurus
Posts: 11
Joined: 04 Sep 2013, 04:44

30 Mar 2020, 07:48

kukeltje wrote:
26 Mar 2020, 19:13
Check the omnifaces viewscoped annotation feature some info there as well. And did you check **what** you store in the viewscoped? Is it big?
It's not big but the instances never are destroyed (Managedbeans)

tecgurus
Posts: 11
Joined: 04 Sep 2013, 04:44

01 Apr 2020, 04:59

I already found the real problem, if I invoke a / logout and in that method I invoke system.gc () if it deletes the instances, but if for some reason I do not logout and just close the browser the instances continue and continue accumulated in memory.

Any idea to this?

Melloware
Posts: 1780
Joined: 22 Apr 2013, 15:48

01 Apr 2020, 13:22

Are you using MyFaces or Mojarra with JoinFaces?
PrimeFaces Developer | PrimeFaces Extensions Developer
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 8.0.1 / PF Extensions 8.0.2

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 3 guests