Forum Discussion
renojim
13 years agoCommunity Streaming Expert
The last time I had problems with running out of memory, I did a few experiments. It seemed that simply setting a variable to invalid didn't accomplish anything. Running the garbage collector also didn't help much. This was based on printing out the results of RunGarbageCollector(). What did seem to help was to let my roScreen go out of scope completely. Running the garbage collector after that also may have helped, but I don't remember if I tried it both ways.
What I ended up with was creating an underlying roImageCanvas in my main routine and then calling a function that created an roScreen and everything else. After I had created numerous bitmaps and at an opportune time, I'd return back to my main routine, thus allowing the roScreen to close and go out of scope, and then run the garbage collector. Then I'd call the function that created the roScreen again and recreate everything. It' not perfect. If you run my app long enough it will still run out memory. Based on the output of RunGarbageCollector() there are still things that are not getting deallocated, but I felt it was good enough and I didn't bother to try to figure out why things I wasn't using anymore weren't getting cleaned up.
I'm not saying that the roScreen is the problem since obviously anything created in the routine that created the roScreen also goes out scope when the routine returns back to main. I'm using many bitmaps and regions.
Obviously, I don't fully understand what's going on with object allocation/deallocation. That's kind of why I said, "Good luck!". If you figure out anything I'd love to hear about it.
-JT
What I ended up with was creating an underlying roImageCanvas in my main routine and then calling a function that created an roScreen and everything else. After I had created numerous bitmaps and at an opportune time, I'd return back to my main routine, thus allowing the roScreen to close and go out of scope, and then run the garbage collector. Then I'd call the function that created the roScreen again and recreate everything. It' not perfect. If you run my app long enough it will still run out memory. Based on the output of RunGarbageCollector() there are still things that are not getting deallocated, but I felt it was good enough and I didn't bother to try to figure out why things I wasn't using anymore weren't getting cleaned up.
I'm not saying that the roScreen is the problem since obviously anything created in the routine that created the roScreen also goes out scope when the routine returns back to main. I'm using many bitmaps and regions.
Obviously, I don't fully understand what's going on with object allocation/deallocation. That's kind of why I said, "Good luck!". If you figure out anything I'd love to hear about it.
-JT