Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZODB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
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
nexedi
ZODB
Commits
a05d4e35
Commit
a05d4e35
authored
Mar 02, 2004
by
Jeremy Hylton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Call _p_deactivate() instead of indirecting through _p_changed.
parent
7851f568
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
8 deletions
+19
-8
src/persistent/cPickleCache.c
src/persistent/cPickleCache.c
+19
-8
No files found.
src/persistent/cPickleCache.c
View file @
a05d4e35
/*****************************************************************************
/*****************************************************************************
Copyright (c) 2001, 2002 Zope Corporation and Contributors.
Copyright (c) 2001, 2002 Zope Corporation and Contributors.
All Rights Reserved.
All Rights Reserved.
...
@@ -90,7 +90,7 @@ process must skip such objects, rather than deactivating them.
...
@@ -90,7 +90,7 @@ process must skip such objects, rather than deactivating them.
static
char
cPickleCache_doc_string
[]
=
static
char
cPickleCache_doc_string
[]
=
"Defines the PickleCache used by ZODB Connection objects.
\n
"
"Defines the PickleCache used by ZODB Connection objects.
\n
"
"
\n
"
"
\n
"
"$Id: cPickleCache.c,v 1.
89 2004/02/19 18:13:35
jeremy Exp $
\n
"
;
"$Id: cPickleCache.c,v 1.
90 2004/03/02 15:37:38
jeremy Exp $
\n
"
;
#define DONT_USE_CPERSISTENCECAPI
#define DONT_USE_CPERSISTENCECAPI
#include "cPersistence.h"
#include "cPersistence.h"
...
@@ -142,16 +142,22 @@ static int cc_ass_sub(ccobject *self, PyObject *key, PyObject *v);
...
@@ -142,16 +142,22 @@ static int cc_ass_sub(ccobject *self, PyObject *key, PyObject *v);
((cPersistentObject *)(((char *)here) - offsetof(cPersistentObject, ring)))
((cPersistentObject *)(((char *)here) - offsetof(cPersistentObject, ring)))
static
int
static
int
scan_gc_items
(
ccobject
*
self
,
int
target
)
scan_gc_items
(
ccobject
*
self
,
int
target
)
{
{
/* This function must only be called with the ring lock held,
/* This function must only be called with the ring lock held,
because it places a non-object placeholder in the ring.
because it places a non-object placeholder in the ring.
*/
*/
cPersistentObject
*
object
;
cPersistentObject
*
object
;
int
error
;
CPersistentRing
placeholder
;
CPersistentRing
placeholder
;
CPersistentRing
*
here
=
self
->
ring_home
.
r_next
;
CPersistentRing
*
here
=
self
->
ring_home
.
r_next
;
static
PyObject
*
_p_deactivate
;
if
(
!
_p_deactivate
)
{
_p_deactivate
=
PyString_InternFromString
(
"_p_deactivate"
);
if
(
!
_p_deactivate
)
return
-
1
;
}
/* Scan through the ring until we either find the ring_home (i.e. start
/* Scan through the ring until we either find the ring_home (i.e. start
* of the ring, or we've ghosted enough objects to reach the target
* of the ring, or we've ghosted enough objects to reach the target
...
@@ -175,6 +181,7 @@ scan_gc_items(ccobject *self,int target)
...
@@ -175,6 +181,7 @@ scan_gc_items(ccobject *self,int target)
if
(
self
->
non_ghost_count
<=
target
)
if
(
self
->
non_ghost_count
<=
target
)
return
0
;
return
0
;
else
if
(
object
->
state
==
cPersistent_UPTODATE_STATE
)
{
else
if
(
object
->
state
==
cPersistent_UPTODATE_STATE
)
{
PyObject
*
meth
,
*
error
;
/* deactivate it. This is the main memory saver. */
/* deactivate it. This is the main memory saver. */
/* Add a placeholder; a dummy node in the ring. We need
/* Add a placeholder; a dummy node in the ring. We need
...
@@ -192,9 +199,12 @@ scan_gc_items(ccobject *self,int target)
...
@@ -192,9 +199,12 @@ scan_gc_items(ccobject *self,int target)
here
->
r_next
->
r_prev
=
&
placeholder
;
here
->
r_next
->
r_prev
=
&
placeholder
;
here
->
r_next
=
&
placeholder
;
here
->
r_next
=
&
placeholder
;
/* In Python, "obj._p_changed = None" spells, ghostify */
/* Call _p_deactivate(), which may be overridden. */
error
=
PyObject_SetAttr
((
PyObject
*
)
object
,
py__p_changed
,
meth
=
PyObject_GetAttr
((
PyObject
*
)
object
,
_p_deactivate
);
Py_None
);
if
(
!
meth
)
return
-
1
;
error
=
PyObject_CallObject
(
meth
,
NULL
);
Py_DECREF
(
meth
);
/* unlink the placeholder */
/* unlink the placeholder */
placeholder
.
r_next
->
r_prev
=
placeholder
.
r_prev
;
placeholder
.
r_next
->
r_prev
=
placeholder
.
r_prev
;
...
@@ -202,8 +212,9 @@ scan_gc_items(ccobject *self,int target)
...
@@ -202,8 +212,9 @@ scan_gc_items(ccobject *self,int target)
here
=
placeholder
.
r_next
;
here
=
placeholder
.
r_next
;
if
(
error
)
if
(
!
error
)
return
-
1
;
/* problem */
return
-
1
;
/* problem */
Py_DECREF
(
error
);
}
}
else
else
here
=
here
->
r_next
;
here
=
here
->
r_next
;
...
...
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