a***@alfarrabio.di.uminho.pt
2007-01-08 18:16:57 UTC
Hi
I am trying to debug some code that is using too much memory. I am not
sure if it is from the XS code, but if you say it isn't at least I know
I should look elsewhere.
Here it is (resumed):
array = newAV();
av_push(array, newSVuv(dictionary_get_occ(D, wid)));
for (j = 0; j < MAXENTRY; j++) {
twid = 0;
prob = 0.0;
twid = dictionary_get_id(D, wid, j);
if (twid) {
prob = dictionary_get_val(D, wid, j);
# tword can't be freed...
tword = word_list_get_by_id(T, twid);
if (!tword) { fprintf(stderr, "Id: %d\n", twid); }
av_push(array, newSVpvn(tword, strlen(tword)));
av_push(array, newSVnv((double)prob));
}
}
RETVAL = newRV_noinc((SV*)array);
OUTPUT:
RETVAL
Am I doing something wrong? Maybe because of refcounts and such?
Thanks
ambs
I am trying to debug some code that is using too much memory. I am not
sure if it is from the XS code, but if you say it isn't at least I know
I should look elsewhere.
Here it is (resumed):
array = newAV();
av_push(array, newSVuv(dictionary_get_occ(D, wid)));
for (j = 0; j < MAXENTRY; j++) {
twid = 0;
prob = 0.0;
twid = dictionary_get_id(D, wid, j);
if (twid) {
prob = dictionary_get_val(D, wid, j);
# tword can't be freed...
tword = word_list_get_by_id(T, twid);
if (!tword) { fprintf(stderr, "Id: %d\n", twid); }
av_push(array, newSVpvn(tword, strlen(tword)));
av_push(array, newSVnv((double)prob));
}
}
RETVAL = newRV_noinc((SV*)array);
OUTPUT:
RETVAL
Am I doing something wrong? Maybe because of refcounts and such?
Thanks
ambs
--
Alberto Simões - Departamento de Informática - Universidade do Minho
Campus de Gualtar - 4710-057 Braga - Portugal
"Beware of bugs in the above code;
I have only proved it correct, not tried it."
--- Donald Knuth
Alberto Simões - Departamento de Informática - Universidade do Minho
Campus de Gualtar - 4710-057 Braga - Portugal
"Beware of bugs in the above code;
I have only proved it correct, not tried it."
--- Donald Knuth