Hi!
I have been using the numba
example on how to implement a linked list using a jitclass
from here. I then added a function to convert from a numpy
array to this list. For an array length of up to ~100,000 elements, the function works as expected, but if there are more than ~1,000,000 I get a segmentation fault when trying to access the first node.
The following function converts the array:
@njit
def convert_array_to_list(arr: np.ndarray):
start_node = make_linked_node(arr[0])
previous_node = start_node
for i in range(1, len(arr)):
previous_node = previous_node.prepend(arr[i])
print(start_node) # Here start node does not seem to be available
return start_node
You could find a whole working example here.
I am running:
- numba: 0.53.0
- python: 3.7
- MacOS: 10.14
Has anyone got a suggestion on why this could happen?