GithubHelp home page GithubHelp logo

High memory consumption about ical4j HOT 10 CLOSED

ical4j avatar ical4j commented on June 28, 2024
High memory consumption

from ical4j.

Comments (10)

benfortuna avatar benfortuna commented on June 28, 2024 1

Yes, because this issue is very old I think it may not apply to the current develop branch of ical4j.

But if you do find this is still an issue feel free to raise a new ticket or we can reopen this one.

from ical4j.

jamieb22 avatar jamieb22 commented on June 28, 2024

acord

from ical4j.

nealeu avatar nealeu commented on June 28, 2024

Hi,
It's also worth noting the ZoneInfo line which is related. If you check duplicates you'll find lots of ZoneInfo object duplicates (in our case all Etc/GMT). These may in our case occur due to hydration of objects from either Hibernate or EhCache, and could be deduplicated within DateTime.setTimezone().

@benfortuna what do you think about some work to deduplicate some of these. In our case we have 250k ZoneInfo objects taking up 4% of memory.

from ical4j.

benfortuna avatar benfortuna commented on June 28, 2024

Hi nealeu,

I suspect the ZoneInfo instances are referenced by java.util.Date instances, or possibly also DateFormat instances, so hopefully they should de-dupe if we optimise the dates. In fact I think the whole problem will go away, or at least change, if we implement the new Java date/time API. But if there are some easy fixes to implement beforehand I will also try to do that.

from ical4j.

nealeu avatar nealeu commented on June 28, 2024

Hi @benfortuna,
Yes, I believe they are. I may be able to take a more detailed look this Friday, and possibly put in a pull request.

from ical4j.

nealeu avatar nealeu commented on June 28, 2024

Hi Ben,
I'm having a look at this now. I suspect what you're saying about the new API is that it's immutable, and therefore doesn't have things like:

public static TimeZone getDefault() {
    return (TimeZone) getDefaultRef().clone();
}

from ical4j.

nealeu avatar nealeu commented on June 28, 2024

Looking at where TimeZone instances get created, most are where no zone is supplied in calls to things like DateTime, and therefore resetTimeZone() is called, which does a .clone().

An example is at DateTime.setTimeZone(TimeZone).

It looks as though we could supply a default singleton into that call, with setID and setRawOffset overridden defensively to prevent modification. I'll give this a go locally.

from ical4j.

benfortuna avatar benfortuna commented on June 28, 2024

older versions now in maintenance mode only

from ical4j.

nealeu avatar nealeu commented on June 28, 2024

@benfortuna Thanks for updating. I can see v4 is a significant change from 3. Are you expecting this to have been resolved in that version?
Thanks.

from ical4j.

nealeu avatar nealeu commented on June 28, 2024

I dove in and I think I have the answer.

This commit shifts to being able to switch to UTC by default (which fits our usage) and therefore uses a singleton.

c754e47#diff-a393647dc44579901b89524b7fe7a4c680cb4506ed868f8ae23305a3645fdba9

from ical4j.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.