Thiyagu has asked for the wisdom of the Perl Monks concerning the following question:
Hi,
I am using below code to read the value of array of strings to the perl script.
Everything works fine, if the perl array size is less than 127. If the array size crosses 127. Abort is seen in sv_setpv function (Heap Corruption in Windows).
SWIG Perl Code to read the character array from the c++ library to perl:
{ int i = 0; while (result[i]) { if(i+1>items){ EXTEND(sp,1); } ST(argvi+i) = sv_newmortal(); sv_setpv((SV *)ST(argvi+i),result[i]);  Abort is hap +pening this point delete [] result[i]; i++; } argvi+=i; delete [] result; }
Is there any limitation in stack size of something else which is causing the issue ?.
Is there is a way overcome this issue ?.
Crash Dump:
FAULTING_THREAD: 0000000000000c5c DEFAULT_BUCKET_ID: HEAP_CORRUPTION PRIMARY_PROBLEM_CLASS: HEAP_CORRUPTION BUGCHECK_STR: APPLICATION_FAULT_HEAP_CORRUPTION_NULL_CLASS_PTR_DEREFE +RENCE_INVALID_POINTER_READ_WRONG_SYMBOLS_FILL_PATTERN_ffffffff LAST_CONTROL_TRANSFER: from 00007ffb262d21b2 to 00007ffb262d23c3 STACK_TEXT: 00000000`001bee80 00007ffb`262d21b2 : 00000000`02000002 00007ffb`00000 +000 00000000`000000a8 00000000`00000000 : ntdll!RtlAllocateHeap+0x2f3 00000000`001bef30 00007ffb`25f01d36 : 00000000`00000001 00000000`00000 +002 00000000`000000a8 00000000`00000000 : ntdll!RtlAllocateHeap+0xe2 00000000`001bf040 00000000`5825996d : 00000000`00000090 00000000`007a5 +df8 00000000`00000001 00000000`585125f0 : msvcrt!malloc+0x56 00000000`001bf070 00000000`58262a9a : 00000000`00000002 00000000`5848d +ef1 00000000`00000000 00000000`000000c5 : perl516!VMem::Malloc+0x1d [ +e:\codavs05\hpsw-opcsi\external\perl\5.16.0\win5.2_64\perl-5.16.0\win +32\vmem.h @ 166] 00000000`001bf0a0 00000000`5829bee5 : 00000000`022c2630 00000000`00000 +090 00000000`007a5df8 00000000`01dd44f0 : perl516!Perl_safesysmalloc+ +0x4a [e:\codavs05\hpsw-opcsi\external\perl\5.16.0\win5.2_64\perl-5.16 +.0\util.c @ 102] 00000000`001bf0d0 00000000`5828e521 : 00000000`022c2630 00000000`007a5 +df8 00000000`00000003 00000000`00000000 : perl516!Perl_sv_grow+0x135 +[e:\codavs05\hpsw-opcsi\external\perl\5.16.0\win5.2_64\perl-5.16.0\sv +.c @ 1521] 00000000`001bf100 00007ffb`1d87cf03 : 00000000`007a5df8 00000000`00000 +003 00000000`022c5dc8 00000000`00000000 : perl516!Perl_sv_setpv+0xb1 +[e:\codavs05\hpsw-opcsi\external\perl\5.16.0\win5.2_64\perl-5.16.0\sv +.c @ 4550]
suggest me, is there is a way to read the array for more than 127 array size.
Thanks and Regards,
Thiyagu
2018-08-02 Athanasius added code and paragraph tags
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: sv_setpv aborts when the SV (perl output array)have more than 127 size
by dave_the_m (Monsignor) on Jul 31, 2018 at 13:35 UTC | |
|
Re: sv_setpv aborts when the SV (perl output array)have more than 127 size
by Corion (Patriarch) on Jul 31, 2018 at 12:54 UTC | |
|
Re: sv_setpv aborts when the SV (perl output array)have more than 127 size
by anonymized user 468275 (Curate) on Jul 31, 2018 at 13:34 UTC |