Coder Social home page Coder Social logo

Comments (11)

junyer avatar junyer commented on September 26, 2024

TCMalloc isn't the C++ compiler. TCMalloc is a memory allocator.

from tcmalloc.

NeilZhy avatar NeilZhy commented on September 26, 2024

@junyer Yes, I know TCMalloc is a memory allocator. Please take a closer look at my question. My question is that after using tcmalloc to run the program, there are still a lot of dynamic memory allocations in my program caused by using std::vector.

from tcmalloc.

junyer avatar junyer commented on September 26, 2024

Please clarify (a) what a memory allocator should have done, (b) how that could have been done and (c) which memory allocators would have done that. At the risk of stating the obvious, a memory allocator is a library that allocates memory; expecting it to "optimise" how it gets called is like expecting libc to "optimise" how it gets called to, say, fopen(3) and fclose(3) FILEs. There's nothing here beyond wishful thinking.

from tcmalloc.

thelex0 avatar thelex0 commented on September 26, 2024

a) these are not tcmalloc function names. are you sure that program using tcmalloc?
b) tcmalloc has limited cpu cache bounds, so it's not true that there won't be any allocations after a few minutes

from tcmalloc.

junyer avatar junyer commented on September 26, 2024

Indeed, various caches are bounded in various ways. Moreover, it's conceivable that at least some allocations are larger than kMaxSize.

from tcmalloc.

NeilZhy avatar NeilZhy commented on September 26, 2024

a) these are not tcmalloc function names. are you sure that program using tcmalloc? b) tcmalloc has limited cpu cache bounds, so it's not true that there won't be any allocations after a few minutes

a. I use tcmalloc to load my program in the following way.
LD_PRELOAD=path/to/gperftools/lib/libtcmalloc.so ./my_test_program
b. I noticed that github:tcmalloc has the MallocExtension::instance()->SetMaxPerCpuCacheSize interface, but these interfaces are not in github:gperftools. I did some configuration by using the github:gperftools's MallocExtension::instance()->SetNumericProperty( "tcmalloc.max_total_thread_cache_bytes", 100 * 1024 * 1024); interface, but it had no effect.

from tcmalloc.

junyer avatar junyer commented on September 26, 2024

Is there some reason why this issue wasn't filed against https://github.com/gperftools/gperftools?

from tcmalloc.

junyer avatar junyer commented on September 26, 2024

If you aren't using TCMalloc as provided by this project, is there some reason to seek support from this project? gperftools is a separate (older) project with a different (older) implementation of TCMalloc that, in particular, doesn't offer per-CPU caching.

from tcmalloc.

junyer avatar junyer commented on September 26, 2024

I see you filed gperftools/gperftools#1517, so I think we are done here.

from tcmalloc.

junyer avatar junyer commented on September 26, 2024

Spamming unrelated projects is bad open source citizenship, IMO, but good luck with that.

from tcmalloc.

junyer avatar junyer commented on September 26, 2024

It's also worth noting that even the issue title ("tcmalloc cannot optimize dynamic memory allocation caused by std::vector.") is at best a miscommunication and at worst a misrepresentation. It's unclear that there's any problem here beyond your misunderstanding of how to behave towards open source projects and how to respect people's time and attention.

from tcmalloc.

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.