Error in `./a.out’: free(): invalid next size (fast): 0x0000000001da8010
*** Error in `./a.out': free(): invalid next size (fast): 0x0000000001da8010 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x777f5)[0x7f216399b7f5]
/lib/x86_64-linux-gnu/libc.so.6(+0x8038a)[0x7f21639a438a]
/lib/x86_64-linux-gnu/libc.so.6(cfree+0x4c)[0x7f21639a858c]
./a.out[0x400896]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0)[0x7f2163944840]
./a.out[0x400609]
======= Memory map: ========
00400000-00401000 r-xp 00000000 08:01 1155 /home/csgec/C++/a.out
00600000-00601000 r--p 00000000 08:01 1155 /home/csgec/C++/a.out
00601000-00602000 rw-p 00001000 08:01 1155 /home/csgec/C++/a.out
01da8000-01dc9000 rw-p 00000000 00:00 0 [heap]
7f215c000000-7f215c021000 rw-p 00000000 00:00 0
7f215c021000-7f2160000000 ---p 00000000 00:00 0
7f216370e000-7f2163724000 r-xp 00000000 08:01 923094 /lib/x86_64-linux-gnu/libgcc_s.so.1
7f2163724000-7f2163923000 ---p 00016000 08:01 923094 /lib/x86_64-linux-gnu/libgcc_s.so.1
7f2163923000-7f2163924000 rw-p 00015000 08:01 923094 /lib/x86_64-linux-gnu/libgcc_s.so.1
7f2163924000-7f2163ae4000 r-xp 00000000 08:01 953576 /lib/x86_64-linux-gnu/libc-2.23.so
7f2163ae4000-7f2163ce4000 ---p 001c0000 08:01 953576 /lib/x86_64-linux-gnu/libc-2.23.so
7f2163ce4000-7f2163ce8000 r--p 001c0000 08:01 953576 /lib/x86_64-linux-gnu/libc-2.23.so
7f2163ce8000-7f2163cea000 rw-p 001c4000 08:01 953576 /lib/x86_64-linux-gnu/libc-2.23.so
7f2163cea000-7f2163cee000 rw-p 00000000 00:00 0
7f2163cee000-7f2163d14000 r-xp 00000000 08:01 953568 /lib/x86_64-linux-gnu/ld-2.23.so
7f2163ef7000-7f2163efa000 rw-p 00000000 00:00 0
7f2163f12000-7f2163f13000 rw-p 00000000 00:00 0
7f2163f13000-7f2163f14000 r--p 00025000 08:01 953568 /lib/x86_64-linux-gnu/ld-2.23.so
7f2163f14000-7f2163f15000 rw-p 00026000 08:01 953568 /lib/x86_64-linux-gnu/ld-2.23.so
7f2163f15000-7f2163f16000 rw-p 00000000 00:00 0
7ffcd77e9000-7ffcd780a000 rw-p 00000000 00:00 0 [stack]
7ffcd798b000-7ffcd798e000 r--p 00000000 00:00 0 [vvar]
7ffcd798e000-7ffcd7990000 r-xp 00000000 00:00 0 [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall]
fish: Job 2, “./a.out” terminated by signal SIGABRT (Abort)
resolvent:
unsigned int *a = (unsigned int *)malloc(sizeof(unsigned int) * 2 * n);
Malloc dynamically allocates memory. N must have confirmed the value
① you can add int n = 5 before applying for space
int n = 5;
unsigned int *a = (unsigned int *)malloc(sizeof(unsigned int) * 2 * n);
⑤ You can also allocate space after user input, so that the value of n is known
unknown dynamic space cannot be allocated before user input.
scanf("%d %d",&n,&m);
// getchar();
unsigned int *a = (unsigned int *)malloc(sizeof(unsigned int) * 2 * n);
After correction, the error report can disappear.
Read More:
- RuntimeError: Expected hidden[0] size (x, x, x), got(x, x, x)
- Free(): invalid pointer error when libtorch runs under Linux
- Solve the problem that “figure size 640×480 with 1 axes” does not display pictures in jupyter notebook
- 1067 – Invalid default value for ‘sex‘1366 – Incorrect string value: ‘\xE6\x8A\x80\xE6\x9C\xAF…‘ f
- Error when creating partitions in Linux: no free sectors available solution
- When installing software in Ubuntu, it prompts: E: You don’t have enough free space in /var/cache/apt/archives/.
- error C2057: expected constant expression (Can the size of an array in C language be defined when the program is running?)
- Unicode decodeerror: ‘UTF-8’ codec can’t decode byte 0x80 in position 3131: invalid start byte solution
- Abnormal crash of APP startup — pointer being free was not allocated * * set a breakpoint in malloc_ error_ break to debug
- Copying a param with shape torch. Size ([262, 2048]), parameter size does not match
- [Solved] emulator: glteximage2d: got err pre 🙁 0x502 internal 0x1908 format 0x1908 type 0x1401
- Invalid Drive:H:\ (subst X: %TEMP%)
- raise ValueError(‘Expected input batch_size ({}) to match target batch_size ({}).‘
- JSON parse e rror: Invalid UTF-8 middle byte 0x3f;
- ERROR: invalid byte sequence for encoding “UTF8”: 0x00
- How to distinguish the source channel of router.push jump fast application
- How to Fix Error CGContextSetStrokeColorWithColor: invalid context 0x0