Code Monkey home page Code Monkey logo

Comments (6)

fumeboy avatar fumeboy commented on August 16, 2024 1

https://github.com/golang/go/blob/3e7ec131667c31448365f47643cf9b58d08ffd26/src/runtime/heapdump.go#L118

another point worth paying attention to, runtime/debug.WriteHeapDump will store *_type to typecache

from goloader.

pkujhd avatar pkujhd commented on August 16, 2024

This memory cannot be released.
remove itab from itabtable to avoid invalid address errors if it is not allocated to the same block of memory during load the same obj file again.

from goloader.

eh-steve avatar eh-steve commented on August 16, 2024

Also it's worth noting that this code path is only hit for relatively infrequent dynamic interface assignments (not static ones, where an itab would have been emitted by the compiler and so would be in mmapped memory instead)

from goloader.

pkujhd avatar pkujhd commented on August 16, 2024

https://github.com/golang/go/blob/3e7ec131667c31448365f47643cf9b58d08ffd26/src/runtime/heapdump.go#L118

another point worth paying attention to, runtime/debug.WriteHeapDump will store *_type to typecache

@fumeboy
This seems to be only used during call heapdump.
*_type is stored in typecache, but it only use pointer for comparison. If the type does not exist, adding it.
it seems does not cause problem, but it retains useless data.
I tested dump heap when loaded the module, and dump heap after unload module, the process exits as normal

from goloader.

eh-steve avatar eh-steve commented on August 16, 2024

Yeah, types are only dumped which are currently in the itabtable, so old types that have been cached are never indirected (they should eventually get bumped off the bucket of 4 if enough hash collisions happen).

from goloader.

fumeboy avatar fumeboy commented on August 16, 2024

https://github.com/golang/go/blob/a031f4ef83edc132d5f49382bfef491161de2476/src/reflect/type.go#L1558

reflect's lookupCache will also keep pointer to _type, and it is safe to delete.

from goloader.

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.