Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Register
  • Sign in
  • gjs gjs
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 116
    • Issues 116
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 18
    • Merge requests 18
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • GNOMEGNOME
  • gjsgjs
  • Issues
  • #144
Closed
Open
Issue created Apr 15, 2018 by Carlos Garnacho@carlosgDeveloper

Reduce memory overhead of g_object_weak_ref()

Every GjsMaybeOwned creates a weak ref on the GjsContext so it can be properly tear down on context finalization. This seems however fairly expensive...

According to heaptrack, and in stress situations (i.e. many objects being created), g_object_weak_ref() is the busiest place in terms of total memory allocated from a single point, and even may potentially grow to be the single biggest memory allocation made by gnome-shell.

Screenshot_from_2018-04-15_17-44-08

It seems we can ease that quite a bit. I made a couple of patches that keep a single weak ref for all ObjectInstances (relying on #142 (closed)). The other source of GjsMaybeOwned is in closure.cpp, but those are very transient and rarely add up to a significant number.

With these patches, this function virtually disappears from those stats.

Assignee
Assign to
Time tracking