|
Realloc is always a poor performer as it needs to allocate a new block large enough to fit the request, then copy the memory from the old location to the new one and then return. As a general rule, I try and limit the malloc's and free's that a program uses as much as possible. They tend to be expensive and make performance very non-linear. This is both AS/400 and Windows. Havent done much Linux/Unix work so I don't know about that. Bob > -----Original Message----- > From: c400-l-bounces@xxxxxxxxxxxx [mailto:c400-l-bounces@xxxxxxxxxxxx] On > Behalf Of Zvi Kave > Sent: Wednesday, June 30, 2004 9:29 AM > To: c400-l@xxxxxxxxxxxx > Subject: [C400-L] Porting C Linux to ILE C: Performance problem > > Dear collegues, > > 1. I ported succesfully(?) C coded software from Linux > > to ILE C. > 2. The sample program I use, takes in Linux 1 second. > The same program run takes on the AS/400 ... > 7 minutes!? > 3. When debugging the program on the AS/400, I found > that the slow response is in the memory allocation > routines, namely, calloc, malloc, realloc and > free(). > CPU usage is about 10%. > 4. Those memory management routines are managed by > linked list which is allocated in the beginning of > program and free()d before end. > > Is there any reason for that performance problem? > > Please help. > > Regards, > > Zvi > > __________________________________________________ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.com > _______________________________________________ > This is the C programming iSeries / AS400 (C400-L) mailing list > To post a message email: C400-L@xxxxxxxxxxxx > To subscribe, unsubscribe, or change list options, > visit: http://lists.midrange.com/mailman/listinfo/c400-l > or email: C400-L-request@xxxxxxxxxxxx > Before posting, please take a moment to review the archives > at http://archive.midrange.com/c400-l.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.