Re: [AD] Changing malloc/memset to calloc

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On 9 Aug 2011, at 23:35 , Trent Gamblin wrote:
> So it's possible that always doing malloc->memset is causing memory to be mapped more quickly than it would be with calloc. In any case, as I said, malloc is failing in my app and I'm not using all that much memory. Background: on iOS, when your program starts, the OS will begin sending low memory warnings to background apps, which should then free memory if possible. It can also flat out kill background apps. But it takes time between the OS sending low memory warnings, and the apps responding, and it's during this time that my program is allocating lots of memory. This time happens to be program startup, which is very commonly where you allocate a lot of memory.

Interesting. My first reaction is that there's a design problem there, but on second thought, it's not such a trivial problem to solve.

> I heard it through the grapevine that tjaden didn't want to include al_calloc, and so I don't want to convert all malloc/memset to calloc if someone is going to change it all back. What I can do is do the conversion and then if it fixes the problem, commit it, or, just commit it anyway (which I think is sensible given the information from the DTS person.)

Well, using calloc rather than malloc/memset sounds like a sensible thing to me (same effect, but using a library function that may do it more efficiently than the two seperate functions) so I'd say go ahead with the change...

Just IMO of course.

Evert





Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/