Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add memory limit waiver for pid #1315

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kvs-coder
Copy link

@kvs-coder kvs-coder commented Dec 20, 2024

iOS provides strict limits regarding memory usage (especially for extensions).

There is a method - (NSNumber *)requestDisableMemoryLimitsForPid:(int)arg1; of header file DTProcessControlServiceAuthorizedMethods.h which sounded promising to utilize

By sending a message call to invoke that method, the iOS responds with either 0 (false) or 1 (true) if memory limit disabling request was declined or satisfied respectively

Full command to test:

pymobiledevice3 developer dvt memlimitoff <PID> --rsd <IPV6-ADDRESS> <RSD-PORT>

Expected command output:

true

OR

false

Copy link
Owner

@doronz88 doronz88 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your PR! It'll be a very nice feature to have :)).
Please view the submitted notes

@@ -40,6 +40,14 @@ def signal(self, pid: int, sig: int):
self._channel.sendSignal_toPid_(MessageAux().append_obj(sig).append_obj(pid), expects_reply=True)
return self._channel.receive_plist()

def memlimitoff(self, pid: int) -> list:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add a docstring for the returned list and supply the list with a specific type (e.g. list[dict[str, str]]]).
I know still most of current API don't use these typing, but I'm trying that at least all new code or modified one will have better typings

"""
Test disabling memory limit.
"""
aggregated = get_process_data(dvt, 'SpringBoard')
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably meant springboard for the variable? or did u actually plan to check with SpringBoard?

res = ProcessControl(dvt).memlimitoff(aggregated['pid'])
# give the os some time to respond
time.sleep(3)
assert res
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

depending on what should be returned, maybe add a better verification

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants