Corona® Profiler- A Line-by-Line Analysis of Your Code - New Update

@y.sravankumar - Try switching the call to physics.stop(), to physics.pause() and see if that clears up your issue. Pausing physics is probably what you want, unless you are quitting the game. I have read that the only safe place to call physics.stop() is in OnApplicationExit.

Try that and see how it goes.

[import]uid: 5317 topic_id: 17975 reply_id: 86102[/import]

@mike4
yes, it’ll solve this problem but introduces another problem.
in my case I’ve to place concrete block kind of structure to physics. if I place concrete blocks (with dimensions of 60) as stack at say x=10
and in next level if placed concrete blocks at say x=30. then some how concrete blocks are jumping as if they are colliding with previously placed blocks.
if I stop physics and start when levels is loaded, then this problem is not observed.
I prepared sample code, which exactly replicates the problem. I can post here if you want to take a look [import]uid: 97420 topic_id: 17975 reply_id: 86104[/import]

@y.sravankumar - Make sure you remove all the objects that are using physics in the first level, before you build the next level.

Ideally, you would remove all the display objects using physics, then pause physics, then in the next level add the new physics objects. You could also use timer.performWithDelay() to wait a tick or two, and then call the garbage collector to make sure everything is cleaned up, and then pause physics.

Sounds like you are pausing and removing and creating a little to quickly, so some things may be hanging around and not properly collected. [import]uid: 5317 topic_id: 17975 reply_id: 86117[/import]

@mike4,
in my game there is considerable delay in loading next level.
and I called GC, but no difference
I’ve placed sample code, please have a look at it.

http://pastebin.com/LwaDd8uu

edit: I used ManyCrates example shipped with Corona [import]uid: 97420 topic_id: 17975 reply_id: 86119[/import]

@y.sravankumar,

Can you please tell us why you are pausing the physics engine? In our apps we just remove all physics bodies form the scene but we never had to pause or stop the physics engine to transition from scene to scene. Perhaps after removing the objects you may need to wait a few frames for the physics engine to properly remove the objects? We will take a look at your code, thanks for sharing!

@Mike,
Thanks for your help!

M.Y. Developers [import]uid: 55057 topic_id: 17975 reply_id: 86127[/import]

@M.Y.

I’m involved in developing “Link” game (you can fine free version in Apple market). if I don’t pause or stop, constructed bridge is going out of order when added to physics (user starts simulation to test constructed bridge).
In this game user can start and stop simulation at any time

edit: sorry M.Y., for hijacking your thread, it is not intentional
edit2: I posted this problem in Bug report, please post your suggestion there, instead of mixing this useful thread.
[Link]
http://developer.anscamobile.com/forum/2012/02/10/physics-pause-call-displacing-objects
Thank you mike and M.Y. for looking into my problem

[import]uid: 97420 topic_id: 17975 reply_id: 86133[/import]

@y.sravankumar,

No problem, glad we could help. We posted a possible solution on
the other forum post.

Thanks,
M.Y. Developers
[import]uid: 55057 topic_id: 17975 reply_id: 86250[/import]

I tried to use diffsnapshot to track a mem leak I have in my app (when switching scene using director and textcandy)
It seems the biggest difference is :
size increase var name defined in
10677 tableDict global

Unfortunately, I have no idea what tableDict means … [import]uid: 9328 topic_id: 17975 reply_id: 86313[/import]

Hello Antheor,

Is the tableDict global growing by that much consistently? Can you perhaps send us some code we can look at? We do not use globals in profiler.lua so it is not coming from there.
It might be a part of Lua’s internals? Check out this thread:

http://developer.anscamobile.com/forum/2011/02/22/incredibly-frustrating

Edit: Just stumbled across the daily build notes 2012.744 quote

core: Made tableDict a “local” to fix strict.lua runtime error. case

Thanks,
M.Y. Developers [import]uid: 55057 topic_id: 17975 reply_id: 86338[/import]

The “Edit” means that my mem leaks comes from a bug that is corrected in duild 2012.744 ? (that would be cool)

As for yout very kind proposition at looking at my code, I 'll try first to narrow the issue and make the smallest sample code as possible :)) [import]uid: 9328 topic_id: 17975 reply_id: 86441[/import]

I tried to narrow my code and realized that the tabledict and mem leak are close to 0 when avoiding TextCandy effects.
I must do something wrong with this (great) lib. I follow this point on xpressive forum section.

Thx anyway for your support ( I would send my code if I fall on something I really can’t figure out :slight_smile: [import]uid: 9328 topic_id: 17975 reply_id: 86445[/import]

Antheor,

Did you solve your problem? We are curious to know if you found something. It is unlikely a library like TextCandy will have memory leaks but perhaps tabledict tells us something else. It would help us all if you posted your results here.

Thanks,
M.Y. Developers [import]uid: 55057 topic_id: 17975 reply_id: 86953[/import]

I made a post on xpressive forum :
http://developer.anscamobile.com/forum/2012/02/12/text-candy-memory-leak#comment-87082

I 'll try soon the daily build myself and will tell you if the 2012.744 solves the issue. [import]uid: 9328 topic_id: 17975 reply_id: 87083[/import]

Hello Antheor,

Any luck with the memory leak?

Thanks,
M.Y. Developers [import]uid: 55057 topic_id: 17975 reply_id: 87898[/import]

I had no answer in the other post, and haven’t tried the build 744 yet. I’m working on cleaning my code and screen transitions.
Anyway, thx for your interest :)) [import]uid: 9328 topic_id: 17975 reply_id: 87946[/import]

Hi Antheor,

No problem. Let us know when you find anything.

-M.Y. Developers [import]uid: 55057 topic_id: 17975 reply_id: 88163[/import]

Hello Antheor,

We hope profiler is working well for you and please let us know if you have any problems or suggestions.

Thank you,
M.Y. Developers [import]uid: 55057 topic_id: 17975 reply_id: 92459[/import]

Hello Community,

We hope Profiler is working well for everyone. Please let us know if you have any suggestions for features you would like to see in our next update.

Thank you,
M.Y. Developers [import]uid: 55057 topic_id: 17975 reply_id: 93147[/import]

Hi!

It’s working great, I just have one question.
What are people referring to when they’re saying things like

“Your Corona profiler helps me to improve the performance of my game dramatically!!! I started from using 22 sec from 25 on PC) and now it 0,8-1,5 sec from 25.”

I’ve seen others making similar statements but I can’t quite understand what it means. [import]uid: 129450 topic_id: 17975 reply_id: 93297[/import]

Hello info583,

Thank you for trying it out!
I started from using 22 sec from 25 on PC, and now it 0,8-1,5 sec from 25.
PC probably means Particle Candy library. 22-25 seconds means that initially the particle candy code was using 22-25 seconds of profile time. After some optimization guided by specific functions reported by profiler, he was able to get the usage time down to 8 seconds, a 3 fold increase in performance.

The point is that profiler can tell you exactly what functions are slowing down your code and you can modify them and see if your modifications actually made a difference, and you can quantify how much.

Hope that clarifies things,
M.Y. Developers [import]uid: 55057 topic_id: 17975 reply_id: 93391[/import]