App memory management

I have used Activity Monitor to look at a small project memory usage. Upon start it takes 7 MB. After filling a listbox with about 500 records, it jumps to 10.10 MB. Then it goes back down to a stable 9.3 MB. After a while, it goes down to 6.7 MB and 3 Threads (the app does not use programming threads ?).

The app size is 10.4 MB, so apparently all is not uploaded.

It seems that the system allocates more or less memory according to what happens in the app. Or more probably that some mechanism inside the app automatically requests more memory when needed, and relinquishes it when unused.

I know Xojo keeps a tab on an app memory, but is there a way to actually know how much memory an app is using internally, and has available ?

Or is the question irrelevant because it changes all the time, it is automatic, or the information simply cannot be retrieved ?

Has this even been answered because i am also in search of a Method to show to my users the amount of memory my app allocates.

Runtime.MemoryUsed

Pretty sure this won’t include memory from declare use, not sure about plugins.

normal allocators in C allocate big blocks to pass them in small chunks to the app.
This way memory management can effectively handle small memory allocations.

I have an App in which filling Listboxes over and over again, causes the App to allocate more and more Memory. Until i have fixed this, i would like to inform my users once the App reaches 1GB+, so they can restart the App before it crashes…

It sounds like you might have a circular reference somewhere, if the leak is within your code.

Thank you Kim. I am already investigating it. You may be correct, because i use my own Subclassed ListBox. :slight_smile: