comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » More efficient method of appending to arrays when using pointers?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
More efficient method of appending to arrays when using pointers? [message #74171] Tue, 04 January 2011 14:01
Matt Francis is currently offline  Matt Francis
Messages: 94
Registered: May 2010
Member
I have some code I've written that looks clunky and I was wondering if
there is a more efficient (faster and or using less memory) way to do
this.

I am using a custom object with a member self.foo which will end up
being a matrix, built up by appending arrays one at a time as I loop
over each step of a process. This update code currently looks like
this:

temp = [ *(self.foo),next_array]
ptr_free,self.foo
self.free = ptr_new(temp)

This seems to be a bit wastefull in terms of how many times memory is
allocated and deallocated to get the job done. Something simple like

self.free = ptr_new([*(self.foo),next_array]

causes a memory leak due to the dangling pointer. I don't see how the
TEMPORARY function can be used here without causing a leak.

Any tips from the pros?
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: How to use widget button as equivalent for keyword selector
Next Topic: TrueType fonts question

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 15:48:50 PDT 2025

Total time taken to generate the page: 0.00385 seconds