visualdatatools.com Forum Index visualdatatools.com
Discussion for DataTank and DataGraph
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

IncreaseSize()

 
Post new topic   Reply to topic    visualdatatools.com Forum Index -> Using External Programs
View previous topic :: View next topic  
Author Message
Adam



Joined: 01 Dec 2006
Posts: 61
Location: Sequim, WA

PostPosted: Wed Jun 13, 2007 1:11 pm    Post subject: IncreaseSize() Reply with quote

I made a dumb mistake in a program I wrote using DTSource, and ended up calling IncreaseSize() too frequently on a DTMutableDoubleArray. Watching the program in Activity Monitor before it crashed (couldn't allocate enough memory), the memory usage doubled every few seconds, and profiling showed that all of the time was being spent in IncreaseSize().

I don't grok C++ very well, but the IncreaseSize implementation appears to be in DTArrayTemplates.h, and it basically creates a new array and does a memcpy of the old pointer to the new one. Since the array is mutable, would it be more efficient to realloc(), or is that not possible because the underlying storage may not use malloc()? This is just an academic question, since I fixed the mistake in my code and no longer call IncreaseSize() on very large arrays Smile.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    visualdatatools.com Forum Index -> Using External Programs All times are GMT - 3 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group