larksuite / larksuite/oapi-sdk-python

消耗太多内存

Open
#74 0 comments 6 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
559
Forks
102
PR merge metrics
No merged PRs in 30d

Description

import os


def print_memory():
    print(process_memory())


def process_memory():
    process = psutil.Process(os.getpid())
    mem_info = process.memory_info()
    return mem_info.rss // (1024 * 1024)


def main():
    print_memory()  # prints 17
    import lark_oapi

    print_memory()  # prints 116


if __name__ == "__main__":
    main()

测试平台

uname -a                              
Linux <MY_MACHINE_NAME> 6.5.0-35-generic #35~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue May  7 09:00:52 UTC 2 x86_64 x86_64 x86_64 GNU/Linux

lark-oapi版本:1.2.8
导入lark_oapi会占用100M内存,太多了,可以解决一下吗?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the provided psutil reproduction on Linux with lark-oapi 1.2.8, comparing memory before and after importing lark_oapi. Trace which part of the import accounts for the increase; done means identifying and reducing the excessive import-time memory use without breaking the SDK.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.