ipfs / kubo

An IPFS implementation in Go
https://docs.ipfs.tech/how-to/command-line-quick-start/
Other
16.17k stars 3.02k forks source link

How to shutdown daemon completely in code or clear the memory of it. #2991

Open zyzhangyang opened 8 years ago

zyzhangyang commented 8 years ago

Version/Platform/Processor information (from ipfs version --all):ipfs version --all

Type (bug, feature, meta, test failure, question):feature Area (api, commands, daemon, fuse, etc):daemon Priority (from P0: functioning, to P4: operations on fire):P3

Description: I have integrated ipfs to mobile client by modifying the main entry to api mode.Now I have to shutdown damon,because ios will suspend the app after it enters background several minutes and ipfs will not work on entering foreground. I get the IpfsNode on daemonfunc,call IpfsNode.close() to close daemon,daemon will return,and I can retart daemon.But the memory will increase after retart daemon everytime. So I want to find methods to shutdown daemon completely,and can reduce the memory of ipfs.

whyrusleeping commented 8 years ago

we havent put much effort yet into mobile, soft restarts like this are going to be very important, as well as a 'background mode' option.

What does memory usage look like for you? 100MB? 200MB?

zyzhangyang commented 8 years ago

@whyrusleeping First I start daemon,the memory usage is about 60MB,after restart daemon every time,it will increase about 40MB,and it will reach 200MB very easy. So I want to know how to modify source code to close daemo completely and release memory?

whyrusleeping commented 8 years ago

@zyzhangyang how are you interfacing with the daemon? as a subprocess, or are you embedding go code?

zyzhangyang commented 8 years ago

@whyrusleeping I modify the main.go in cmd/ipfs to a lib,then compile the ipfs to a framework by using go bind,and then I start a thread to start daemon in ios. Call other ipfs interface in other thread.

whyrusleeping commented 8 years ago

Can you get me any of the profiling information discussed in the debug guide ?

zyzhangyang commented 8 years ago

@whyrusleeping The attach file is the debug info,please see would it help? ios_ipfs_debug_info.zip

xuruijing commented 6 years ago

Can you share your code for ios-ipfs?