1. When alloc or realloc failed in the function SharedBuffer::editResize,
it would return a NULL pointer, then mStorage would update to be 1 by
SharedBuffer::data() if no pointer check here, which is an obviously
wrong address, and would cause corruption when used it e.g. in capacity().
So add the pointer check here for the return value of SharedBuffer::editResize,
if it's NULL do not use it to update mStorage, to avoid the value of mStorage
polluted.
2. when alloc or realloc falied in _grow & _shrink function, mStorage keep
the original value, so mCount should not be updated here.
Otherwise, mStorage might be 0 but mCount>0, so a corruption would happend
when it try to delete items from the Vector since mCount>0.
Change-Id: I7c3814e843c459834ca5eed392e8d63d1cb7d2d8
Signed-off-by: Shuo Gao <shuo.gao@intel.com>
Signed-off-by: Jian Luo <jian.luo@intel.com>
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>
Signed-off-by: Jack Ren <jack.ren@intel.com>
Author-tracking-BZ: 139626
- added a ctor that updates and dumps the stack immediately
- added a "logtag" parameter to dump()
Change-Id: Ie51c256071d282591752243bdb4f68cf9ff8829d
background:
we have some code to fix-up the IDs of references when
using RefBase's DEBUG_REFS when those refs are managed by
arrays wp<> or sp<> (this is because wp<> / sp<> don't have
a trivial ctor when DEBUG_REFS is enabled, and Vector
treats them as trivial for obvious performance reasons)
this is complicated by the fact that we don't want to have
to recompile everything when enabling DEBUG_REFs (i.e.: the
Vector code cannot know wheter it's enabled or not for its
template stuff).
problem:
there was a bug in the fix-up code for wp<> which was trying
to access the weakref_impl from the RefBase* however, this was
moronic since RefBase could have been destroyed if there wasn't
any more strong refs -- and this happned. Instead we need to get
the weakref_impl directly from the wp<>
Change-Id: Ie16e334204205fdbff142acb9faff8479a78450b
- stacks are now saved in /data/debug which must be
created and writable by the user.
- removed "always fatal" DEBUG_REFS option, it wasn't
really needed.
- DEBUG_REFS_ENABLED_BY_DEFAULT is not the default anymore
(usually people want to target which refs they're tracking)
Change-Id: I37fae72e9dacde6ce1fa8f7dbe2bc01b1a1b95e5
When a binder service's main thread joins the thread pool
it retains its name (whatever the exec name was), which is
very confusing in systrace.
we now rename that thread just like its friends in the
thread pool.
Change-Id: Ibb3b6ff07304b247cfc6fb1694e72350c579513e
CallStack::toString() has a 0 default argument, which ends up getting
passed to strlen(), resulting in a crash.
Change-Id: If706aff8c400983670f49cdbb66e11191ac76e0e
ScopedTrace objects were being used in place of ATRACE_NAME because of a
misunderstanding of it's function. Cleared up documentation for usage.
Also explicitly use global namespace for sysprop callback.
Change-Id: I7c248b486b614ccdb841659ca0dcfc644fda670a
The emulator doesn't support systrace, but we should point that out
at most once per process.
Bug 7436352
Change-Id: I06b2c1ea0df6c02c11cd2496423c337f8d7c62a1
This patch adds a hashtable-based LRU cache. This should be
significantly higher performance than the GenerationCache it is intended
to replace. It is a large part of the fix for bug 7271109
TextLayoutCache low-level performance issues.
We added a new method to BasicHashtable to detect when rehashing is
needed, because the internal linked list pointers would get invalidated
by that rehashing.
Also, the hash_type specialized to pointers had a small flaw.
Change-Id: I950c2083f96519777b851dbe157100e0a334caec
some binaries are using these private APIs and broke
(as they should!) with this change. Temporarily restore the
virtuals to work around this.
Bug: 6977550
Change-Id: I7c37f24b16e4d586b89205c493db5169cf87e024
- make errors that will always cause a memory corruption always fatal
(for eg: KeyedVector<>::editValue{For|At}() failure)
- make other errors fatal in debug mode, those that can be caught by
the caller.
- fix typos
Change-Id: I65cc7d81035c37ce2906fc4500c50e5d5b5c49eb
Hand merge from ics-aah
> Utils: Fix a bug in the linear transformation code.
>
> Fix a bug where an incorrect result would be computed if you used the
> linear transformation code to do a reverse transformation (from B's
> domain into A's domain) when the scaler fraction was negative.
>
> Change-Id: I8e5f109314d235a177ab41f65d3c4cd08cff78be
> Signed-off-by: John Grossman <johngro@google.com>
Change-Id: Id90e18f685c61c1a89fd91c32adcf01363b3e8f3
Signed-off-by: John Grossman <johngro@google.com>
would happen when vectors are copied and new items is
added in both vectors. we didn't duplicate the underlying
storage when adding items in vectors.
Bug: 6515797
Change-Id: If544c07d96c05821e088d7f2c9b5736f7e306c31