Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
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
Yusei Tahara
erp5
Commits
86912b5c
Commit
86912b5c
authored
May 31, 2012
by
Vincent Pelletier
Committed by
Sebastien Robin
Aug 07, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Limit the amount of memory used when generating padding over sparse areas.
parent
0fbad18f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
1 deletion
+7
-1
product/ERP5Type/BTreeData.py
product/ERP5Type/BTreeData.py
+7
-1
No files found.
product/ERP5Type/BTreeData.py
View file @
86912b5c
from
BTrees.LOBTree
import
LOBTree
from
persistent
import
Persistent
# Maximum memory to allocate for sparse-induced padding.
MAX_PADDING_CHUNK
=
2
**
20
class
PersistentString
(
Persistent
):
def
__init__
(
self
,
value
):
self
.
value
=
value
...
...
@@ -133,10 +136,13 @@ class BTreeData(Persistent):
for
key
in
tree
.
iterkeys
(
key
):
padding
=
min
(
size
,
key
-
next_byte
)
if
padding
>
0
:
write
(
'
\
x00
'
*
padding
)
next_byte
+=
padding
size
-=
padding
chunk_offset
=
0
while
padding
:
padding_chunk
=
min
(
padding
,
MAX_PADDING_CHUNK
)
padding
-=
padding_chunk
yield
'
\
x00
'
*
padding_chunk
else
:
chunk_offset
=
next_byte
-
key
if
size
==
0
:
...
...
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