Hello everyone, I have been stumped by a programming issue, and would really appreciate any input from a veteran.
Specifically, I believe I have a memory retention issue. My application should be able to run for days on end, but there is a memory build up that eventually causes the application to crash, potentially costing me the results. My program structure is the following:
View Controller, which acts as the main GUI controller and handles all interactions on the GUI from the user. It also possesses objects that control the flow of my program. Those objects have child objects that handle individual iterations of my program's business logic. For the sake of clarity:
ViewController shall be object A.
SubController shall be object B, child of A.
Worker shall be object C, child of B.
Each of these levels has interactions with a single item on the GUI, a console that updates the status of the process and reports any items of note found during the business logic's runtime. Objects C and B both update the console via asynchronous dispatch calls to the main thread. I'm not sure if this is relevant to the problem or not, but I wanted to be clear that all objects have a reference to this GUI item, the reference for which is passed as a parameter to the children.
My application's memory pressure looks like that. The spikey and gradually rising part is during the process where the workers are doing their task, and the flat part is after the iteration set is complete and the workers (and their sub controllers) are released. This is only after a few seconds of running, and over the span of days will eventually fill the system's memory. In my mind, the application should return back to it's original memory pressure when the Worker C is released after it's iteration is complete. However, obviously memory is being left over. When I transfer my session to Instruments, no memory leaks are detected. My application uses ARC to manage memory.
It should probably also be noted that my SubControllers B spawn multiple threads to run multiple Worker objects C at the same time. I'm not sure if multithreading might be interfering with ARC, but it was worth noting. I'll keep an eye on this thread to answer any follow up questions to the best of my ability.
Specifically, I believe I have a memory retention issue. My application should be able to run for days on end, but there is a memory build up that eventually causes the application to crash, potentially costing me the results. My program structure is the following:
View Controller, which acts as the main GUI controller and handles all interactions on the GUI from the user. It also possesses objects that control the flow of my program. Those objects have child objects that handle individual iterations of my program's business logic. For the sake of clarity:
ViewController shall be object A.
SubController shall be object B, child of A.
Worker shall be object C, child of B.
Each of these levels has interactions with a single item on the GUI, a console that updates the status of the process and reports any items of note found during the business logic's runtime. Objects C and B both update the console via asynchronous dispatch calls to the main thread. I'm not sure if this is relevant to the problem or not, but I wanted to be clear that all objects have a reference to this GUI item, the reference for which is passed as a parameter to the children.
My application's memory pressure looks like that. The spikey and gradually rising part is during the process where the workers are doing their task, and the flat part is after the iteration set is complete and the workers (and their sub controllers) are released. This is only after a few seconds of running, and over the span of days will eventually fill the system's memory. In my mind, the application should return back to it's original memory pressure when the Worker C is released after it's iteration is complete. However, obviously memory is being left over. When I transfer my session to Instruments, no memory leaks are detected. My application uses ARC to manage memory.
It should probably also be noted that my SubControllers B spawn multiple threads to run multiple Worker objects C at the same time. I'm not sure if multithreading might be interfering with ARC, but it was worth noting. I'll keep an eye on this thread to answer any follow up questions to the best of my ability.