Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
gjs
gjs
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 94
    • Issues 94
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 15
    • Merge Requests 15
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Incidents
    • Environments
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • GNOME
  • gjsgjs
  • Merge Requests
  • !133

Closed
Created Apr 28, 2018 by Carlos Garnacho@carlosgDeveloper
  • Report abuse
Report abuse

js: Schedule a compacting GC on gjs_gc_if_needed()

  • Overview 5
  • Commits 1
  • Pipelines 2
  • Changes 1

JS_GC() during gjs regular operation will indeed end up scheduling objects for destruction in a timely manner. However on long lived applications object creation/destruction patterns may leave uneven gaps in JS heap arenas that get harder and harder to reuse. Side effects may include more expensive/infructuous GC-ing and increased memory usage.

Introduce the compacting GC [1], a (slightly more expensive) GC mode that is able to transparently compact underused arenas. This mode does not happen by default, Firefox explicitly triggers it from DOM code on user inactivity and memory pressure situations.

We can do similarly, one ideal place to call this is gjs_gc_if_needed(), since we are interested on the application giving up as many pages as it can. This keeps memory fragmentation on hold, helping gnome-shell memory usage stay within certain parameters on long running sessions.

[1] https://hacks.mozilla.org/2015/07/compacting-garbage-collection-in-spidermonkey/

#151 (closed)

Closes: #151 (closed)

Assignee
Assign to
Reviewer
Request review from
GNOME 3.30.0
Milestone
GNOME 3.30.0 (Past due)
Assign milestone
Time tracking
Source branch: compacting-gc