Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
7c6b8ec6
Commit
7c6b8ec6
authored
May 08, 2014
by
antirez
Browse files
DEBUG embstr-classes added.
parent
19f735ce
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/debug.c
View file @
7c6b8ec6
...
@@ -249,6 +249,18 @@ void computeDatasetDigest(unsigned char *final) {
...
@@ -249,6 +249,18 @@ void computeDatasetDigest(unsigned char *final) {
void
debugCommand
(
redisClient
*
c
)
{
void
debugCommand
(
redisClient
*
c
)
{
if
(
!
strcasecmp
(
c
->
argv
[
1
]
->
ptr
,
"segfault"
))
{
if
(
!
strcasecmp
(
c
->
argv
[
1
]
->
ptr
,
"segfault"
))
{
*
((
char
*
)
-
1
)
=
'x'
;
*
((
char
*
)
-
1
)
=
'x'
;
}
else
if
(
!
strcasecmp
(
c
->
argv
[
1
]
->
ptr
,
"embstr-classes"
))
{
int
j
;
char
*
buf
=
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
"BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB"
;
for
(
j
=
1
;
j
<
48
;
j
++
)
{
robj
*
o
=
createEmbeddedStringObject
(
buf
,
j
);
size_t
size
=
zmalloc_size
(
o
);
printf
(
"%d %d (%d)
\n
"
,
j
,
(
int
)
size
,
(
int
)(
sizeof
(
robj
)
+
sizeof
(
struct
sdshdr
)
+
j
+
1
));
decrRefCount
(
o
);
}
}
else
if
(
!
strcasecmp
(
c
->
argv
[
1
]
->
ptr
,
"oom"
))
{
}
else
if
(
!
strcasecmp
(
c
->
argv
[
1
]
->
ptr
,
"oom"
))
{
void
*
ptr
=
zmalloc
(
ULONG_MAX
);
/* Should trigger an out of memory. */
void
*
ptr
=
zmalloc
(
ULONG_MAX
);
/* Should trigger an out of memory. */
zfree
(
ptr
);
zfree
(
ptr
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment