V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
Morriaty
V2EX  ›  Python

Pickle 的文件大小是有压缩的吗?

  •  
  •   Morriaty · 2018-01-05 17:04:56 +08:00 · 4041 次点击
    这是一个创建于 2296 天前的主题,其中的信息可能已经有所发展或是发生改变。
    我用 pickle dump 之后的文件大概是 700M,但 load 之后却占了 8G 的内存。

    去官方文档搜了下,没有关于 size 的说明。
    3 条回复    2018-06-05 09:27:03 +08:00
    hahastudio
        1
    hahastudio  
       2018-01-05 17:13:32 +08:00
    pickle 只是序列化,一个对象反序列化出来会初始化,会带额外的信息,会占用额外的内存啊
    用其他的方法也是一样的效果,比如 xml,json,protobuf
    RicardoScofileld
        2
    RicardoScofileld  
       2018-06-04 17:00:07 +08:00
    @hahastudio 我跟他有同样的疑惑,这样 load 的时候会内存溢出,导致程序直接崩溃,不知道有没有什么好的解决方法
    RicardoScofileld
        3
    RicardoScofileld  
       2018-06-05 09:27:03 +08:00
    楼主 你这个问题找到答案了吗
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   927 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 20:30 · PVG 04:30 · LAX 13:30 · JFK 16:30
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.