V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
推荐学习书目
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 · Jan 5, 2018 · 4649 views
    This topic created in 3034 days ago, the information mentioned may be changed or developed.
    我用 pickle dump 之后的文件大概是 700M,但 load 之后却占了 8G 的内存。

    去官方文档搜了下,没有关于 size 的说明。
    3 replies    2018-06-05 09:27:03 +08:00
    hahastudio
        1
    hahastudio  
       Jan 5, 2018
    pickle 只是序列化,一个对象反序列化出来会初始化,会带额外的信息,会占用额外的内存啊
    用其他的方法也是一样的效果,比如 xml,json,protobuf
    RicardoScofileld
        2
    RicardoScofileld  
       Jun 4, 2018
    @hahastudio 我跟他有同样的疑惑,这样 load 的时候会内存溢出,导致程序直接崩溃,不知道有没有什么好的解决方法
    RicardoScofileld
        3
    RicardoScofileld  
       Jun 5, 2018
    楼主 你这个问题找到答案了吗
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2968 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 77ms · UTC 15:25 · PVG 23:25 · LAX 08:25 · JFK 11:25
    ♥ Do have faith in what you're doing.