Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-1.1
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-1.1
Commits
23293def
Commit
23293def
authored
Jun 01, 2008
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Look for reference leaks. I found none, though.
parent
6391721b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
1 deletion
+26
-1
src/misc/objects.c
src/misc/objects.c
+26
-1
No files found.
src/misc/objects.c
View file @
23293def
...
...
@@ -88,6 +88,7 @@ typedef struct held_list_t
struct
held_list_t
*
next
;
vlc_object_t
*
obj
;
}
held_list_t
;
static
void
held_objects_destroy
(
void
*
);
#endif
/*****************************************************************************
...
...
@@ -152,7 +153,7 @@ void *vlc_custom_create( vlc_object_t *p_this, size_t i_size,
vlc_mutex_init
(
&
structure_lock
);
#ifndef NDEBUG
/* TODO: use the destruction callback to track ref leaks */
vlc_threadvar_create
(
&
held_objects
,
NULL
);
vlc_threadvar_create
(
&
held_objects
,
held_objects_destroy
);
#endif
}
else
...
...
@@ -384,6 +385,7 @@ static void vlc_object_destroy( vlc_object_t *p_this )
/* We are the global object ... no need to lock. */
vlc_mutex_destroy
(
&
structure_lock
);
#ifndef NDEBUG
held_objects_destroy
(
vlc_threadvar_get
(
&
held_objects
)
);
vlc_threadvar_delete
(
&
held_objects
);
#endif
}
...
...
@@ -796,6 +798,7 @@ void __vlc_object_yield( vlc_object_t *p_this )
#ifndef NDEBUG
/* Update the list of referenced objects */
/* Using TLS, so no need to lock */
/* The following line may leak memory if a thread leaks objects. */
held_list_t
*
newhead
=
malloc
(
sizeof
(
*
newhead
));
held_list_t
*
oldhead
=
vlc_threadvar_get
(
&
held_objects
);
newhead
->
next
=
oldhead
;
...
...
@@ -1594,4 +1597,26 @@ void vlc_refcheck (vlc_object_t *obj)
if
(
++
errors
==
100
)
fprintf
(
stderr
,
"Too many reference errors!
\n
"
);
}
static
void
held_objects_destroy
(
void
*
data
)
{
held_list_t
*
hl
=
vlc_threadvar_get
(
&
held_objects
);
vlc_object_t
*
caller
=
vlc_threadobj
();
while
(
hl
!=
NULL
)
{
held_list_t
*
buf
=
hl
->
next
;
vlc_object_t
*
obj
=
hl
->
obj
;
fprintf
(
stderr
,
"The %s %s thread object leaked a reference to...
\n
"
"the %s %s object.
\n
"
,
caller
&&
caller
->
psz_object_name
?
caller
->
psz_object_name
:
"unnamed"
,
caller
?
caller
->
psz_object_type
:
"main"
,
obj
->
psz_object_name
?
obj
->
psz_object_name
:
"unnamed"
,
obj
->
psz_object_type
);
free
(
hl
);
hl
=
buf
;
}
}
#endif
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