Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
U
unique-xids
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
uplex-varnish
unique-xids
Commits
fb3d5385
Commit
fb3d5385
authored
Aug 22, 2011
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SMA->trim() did not return the trimmed space to the pool causing
the SMA to run out of space eventually.
parent
c6e1e88d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
3 deletions
+8
-3
storage_malloc.c
bin/varnishd/storage_malloc.c
+8
-3
No files found.
bin/varnishd/storage_malloc.c
View file @
fb3d5385
...
...
@@ -153,6 +153,7 @@ sma_trim(struct storage *s, size_t size)
struct
sma_sc
*
sma_sc
;
struct
sma
*
sma
;
void
*
p
;
size_t
delta
;
CHECK_OBJ_NOTNULL
(
s
,
STORAGE_MAGIC
);
CAST_OBJ_NOTNULL
(
sma
,
s
->
priv
,
SMA_MAGIC
);
...
...
@@ -160,12 +161,16 @@ sma_trim(struct storage *s, size_t size)
assert
(
sma
->
sz
==
sma
->
s
.
space
);
assert
(
size
<
sma
->
sz
);
delta
=
sma
->
sz
-
size
;
if
(
delta
<
256
)
return
;
if
((
p
=
realloc
(
sma
->
s
.
ptr
,
size
))
!=
NULL
)
{
Lck_Lock
(
&
sma_sc
->
sma_mtx
);
sma_sc
->
stats
->
g_bytes
-=
(
sma
->
sz
-
size
);
sma_sc
->
stats
->
c_freed
+=
sma
->
sz
-
size
;
sma_sc
->
sma_alloc
-=
delta
;
sma_sc
->
stats
->
g_bytes
-=
delta
;
sma_sc
->
stats
->
c_freed
+=
delta
;
if
(
sma_sc
->
sma_max
!=
SIZE_MAX
)
sma_sc
->
stats
->
g_space
+=
sma
->
sz
-
size
;
sma_sc
->
stats
->
g_space
+=
delta
;
sma
->
sz
=
size
;
Lck_Unlock
(
&
sma_sc
->
sma_mtx
);
sma
->
s
.
ptr
=
p
;
...
...
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