Давайте посмотрим, могли ли мы стать ближе к ядру проблемы:
, Если Вы запускаете свою программу (позволяет, говорят), 1000 использований x запускаются (), тогда 1000 x использование выполненного () в потоке, действительно оба освободите память? Если так, тогда Ваш алгоритм должен быть проверен (т.е. на внешние объекты, такие как Векторы, используемые в Вашем Выполнимом).
, Если нет такой утечки памяти, как описано выше тогда Вас, должен заняться расследованиями о стартовых параметрах и использовании памяти потоков относительно JVM.
You need to construct you array differently:
z = np.array(zip([1,2,3,4,5], ['a','b','c','d','e']), dtype=[('int', int), ('str', '|S1')])
np.savetxt('test.txt', z, fmt='%i %s')
when you're passing a sequence, savetext
performs asarray(sequence)
call and resulting array is of type |S4
, that is all elements are strings! that's why you see this error.
If you want to save a CSV file you can also use the function rec2csv (included in matplotlib.mlab)
>>> from matplotlib.mlab import rec2csv
>>> rec = array([(1.0, 2), (3.0, 4)], dtype=[('x', float), ('y', int)])
>>> rec = array(zip([1,2,3,4,5], ['a','b','c','d','e']), dtype=[('x', int), ('y', str)])
>>> rec2csv(rec, 'recordfile.txt', delimiter=' ')
hopefully, one day pylab's developers will implement a decent support to writing csv files.
I think the problem you are having is that you are passing tuples through the formating string and it can't interpret the tuple with %i. Try using fmt="%s", assuming this is what you are looking for as the output:
1 a
2 b
3 c
4 d
5 e