Re: memory fragmentation
On Sat, Aug 07, 2010 at 08:19:47PM +0800, Edwin Eyan Moragas wrote: Hi misc, assuming that a long running app would malloc(3) when needed and then free(3)s the resource immediately when it is done, is memory fragmentation still a concern for long running apps? what are steps that you take to manage this problem if ever it is a problem? best, /e Scenarios do exists where a leak-free process still can run out of mem, i.e. if it does a lot of small allocations, these are scattered through its address space. Big allocations following that could fail, even if the available memory is bigger than the size requested. Otoh, if the sum of your allocations stays below the malloc cache size, malloc will never do any mmap(2) calls after the initial ones and fragmentation will not be any issue. The only answer is: it depends, but in general it is not a problem, this is especially true for 64-bit systems. -Otto
Re: memory fragmentation
* Edwin Eyan Moragas e...@yndy.org [2010-08-08 03:45]: was wondering if there are any special 'moves' that are employed in creating daemons in openbsd that the devs might care to share. yes: don't bother. it's not your job, but the job of the lower layers. -- Henning Brauer, h...@bsws.de, henn...@openbsd.org BS Web Services, http://bsws.de Full-Service ISP - Secure Hosting, Mail and DNS Services Dedicated Servers, Rootservers, Application Hosting
memory fragmentation
Hi misc, assuming that a long running app would malloc(3) when needed and then free(3)s the resource immediately when it is done, is memory fragmentation still a concern for long running apps? what are steps that you take to manage this problem if ever it is a problem? best, /e
Re: memory fragmentation
On Sat, Aug 7, 2010 at 8:19 AM, Edwin Eyan Moragas e...@yndy.org wrote: assuming that a long running app would malloc(3) when needed and then free(3)s the resource immediately when it is done, is memory fragmentation still a concern for long running apps? what are steps that you take to manage this problem if ever it is a problem? you write your own allocator.
Re: memory fragmentation
* Ted Unangst ted.unan...@gmail.com [2010-08-07 19:54]: you write your own allocator. don't. ever. -- Henning Brauer, h...@bsws.de, henn...@openbsd.org BS Web Services, http://bsws.de Full-Service ISP - Secure Hosting, Mail and DNS Services Dedicated Servers, Rootservers, Application Hosting
Re: memory fragmentation
On Sat, Aug 7, 2010 at 4:03 PM, Henning Brauer lists-open...@bsws.dewrote: * Ted Unangst ted.unan...@gmail.com [2010-08-07 19:54]: you write your own allocator. don't. ever. to put it another way, if memory fragmentation ever does become a problem for you, there is probably an easier and safer solution than writing your own allocator. upgrading to a 64-bit platform, for example, is likely to be a far better solution. modifying your app to use malloc(3) and free(3) more conservatively may be a viable option as well, although at that point you're starting down the road of writing your own allocator again. -ken
Re: memory fragmentation
On Sun, Aug 8, 2010 at 4:03 AM, Henning Brauer lists-open...@bsws.de wrote: * Ted Unangst ted.unan...@gmail.com [2010-08-07 19:54]: you write your own allocator. don't. ever. i don't intend to. thank you Ted and Henning for pointing that out. -- Henning Brauer, h...@bsws.de, henn...@openbsd.org BS Web Services, http://bsws.de Full-Service ISP - Secure Hosting, Mail and DNS Services Dedicated Servers, Rootservers, Application Hosting
Re: memory fragmentation
On Sun, Aug 8, 2010 at 4:19 AM, Kenneth Gober kgo...@gmail.com wrote: On Sat, Aug 7, 2010 at 4:03 PM, Henning Brauer lists-open...@bsws.dewrote: * Ted Unangst ted.unan...@gmail.com [2010-08-07 19:54]: you write your own allocator. don't. ever. to put it another way, if memory fragmentation ever does become a problem for you, there is probably an easier and safer solution than writing your own allocator. upgrading to a 64-bit platform, for example, is likely to be a far better solution. modifying your app to use malloc(3) and free(3) more conservatively may be a viable option as well, although at that point you're came across this several times. thank you. i guess this is the way. just lessen calls to malloc and free? but isn't this just a performance concern? was wondering if there are any special 'moves' that are employed in creating daemons in openbsd that the devs might care to share. starting down the road of writing your own allocator again. -ken