Comments (4)
The problem I see is that, in c++, allocating memory isn't typically enough:
you also
need to construct/initialize it. I agree with you: I've wanted a realloc
equivalent
for a while. But I don't see a principled way to do it in C++.
One piece of evidence that this is hard is that the original SGI Allocator
implementation included a realloc function, but the one that eventually made it
out
into the world doesn't:
http://www.sgi.com/tech/stl/alloc.html
http://www.sgi.com/tech/stl/Allocators.html
One interesting note from this discussion:
"This is probably the most questionable design decision. It would have probably
been
a bit more useful to provide a version of reallocate that either changed the
size of
the existing object without copying or returned NULL. This would have made it
directly useful for objects with copy constructors. It would also have avoided
unnecessary copying in cases in which the original object had not been
completely
filled in."
This is exactly the function you're arguing for. So perhaps it *would* be
useful for
STL. But with the standard Allocator type not supporting this kind of realloc,
I'm
not sure how people could use it effectively in their c++ programs. I guess it
would
take a lot of work.
Anyway, I'll definitely take it under consideration. I don't like extending the
tcmalloc API too much beyond the standard API, but I agree that this
functionality is
helpful for c++.
Original comment by [email protected]
on 9 Jun 2009 at 5:56
- Added labels: Priority-Low, Type-Enhancement
from gperftools.
I am currently working with a number of other people, trying to flesh out a
good basis for this. There has been a
number of previous proposals on this issue, and it would be nice to try to take
the best ideas from all these
suggestions.
Original comment by [email protected]
on 10 Jun 2009 at 3:32
from gperftools.
Any more news on this? We've introduced malloc_size(), which does something
like what you want (it doesn't look for unallocated memory adjacent to existing
memory, but it does indicate if the existing memory block is bigger than was
asked for). It may be the most practical solution. If I don't hear back
shortly, I'm going to close this WontFix (or maybe PartiallyFixed? :-) )
Original comment by [email protected]
on 2 Aug 2010 at 4:51
from gperftools.
I guess I defined "shortly" to be "a year" in this case. :-) I'm closing
WontFix, though PartiallyFixed would be more accurate.
Original comment by [email protected]
on 31 Aug 2011 at 10:14
- Changed state: WontFix
from gperftools.
Related Issues (20)
- Dead-lock in PatchAllModules on windows HOT 12
- ERROR - Installing the perftool with gcc 2.95 HOT 6
- using ./configure --disable-shared builds a broken .libs/libprofiler.a HOT 5
- malloc_extension_c.h header missing from installation HOT 4
- Callgrind output should not contain uninteresting frames HOT 4
- lwsync instruction doesn't exist on powerpc e500 core HOT 9
- Could not get the correct call graph after cpu profiling HOT 4
- Error In sbrk() Function Usage HOT 6
- All Files Dont Have Write Permission HOT 1
- Extraneous Check HOT 2
- Problem With munmap() HOT 6
- Patch Offering: Allow 'pprof' to save and restore symbol mappings HOT 23
- cpuprofiler doesn't catch stack frames on linux with gcc 4.1.2/x86 HOT 3
- Can't using tcmalloc with emacs and others HOT 4
- OSX doesn't have objdump, add otool support. HOT 4
- Google perftool crashing HOT 6
- Does tcmalloc use recursion? (Stack overflow with fragmented memory suspected) HOT 3
- Test failures on PPC (Fedora 11, Rawhide) HOT 7
- env HEAPCHECK=normal ./myapp just doesn't work on Linux
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gperftools.