View Full Version : ASARR over Structures

10-17-2005, 11:57 AM
I use both Associative Arrays and Structures to create complex data sets. In some cases, associative arrays make a better fit, as they can be more dynamic at runtime. I can create several levels of hashes with keys defined at runtime based upon the current data files. However, I do imagine that I can run into fragmented memory problems with such a design. I have experienced unexplained segmentation violations which may be caused by my hash structures.


str1 = ASARR(dataset,ASARR(property,ASARR(value,x)))

dataset is a unique keyword for a loaded data file.
property is a property of the data file.
value is the property value

I can then use encapsulated GET/SET routines to change values depending upon which dataset is currently active.

The value can them be a dynamic array of binary data; a string; an integer or any other data type.

Has anyone else worked with ASARR (hashes) in this type of complex fashion? Has anyone had problems with deeply defined associative arrays?


10-18-2005, 07:54 PM
I've played around with that kind of structure a bit, but can't get it to seg fault. Any chance you have some fairly simple code that would replicate the problem?

Of course, seg faults are usually tricky animals to chase down, so it might be hard to find something really simple to test with.

10-18-2005, 09:00 PM

Associative Arrays are heavily used as part of the VDA Tools/Navigator functionality within PV-WAVE. And they get very deep and complex in this type of context.

I agree with Ed; if you can send some sample code that demonstrates what you're doing that causes the seg fault, we'd be happy to take a look at it.

The email address is support@vni.com.

Thanks, Don B.

10-19-2005, 06:48 AM
If I could I would. The problem disappears when I isolate the code -- of course. But it is good to hear that complex hash structures are used internally. I'm not heading down the wrong path. In fact, the hash structures give me a seudo object.

The segment violation occurs on the PLOT command and unlike other errors, I don't get a trace. I also can't catch the error with a handler down at the subroutine level. I will try to catch the error high in the main routines.

And one other item of interest, the fault occurs on the runtime version and not the development version.

10-19-2005, 03:24 PM
Is there any chance you have an outdated WAVE_RT_STARTUP file defined?