[b][u][i]GNU QUALITY[/i][/u][/b]
1
Name:
Anonymous
2011-11-14 17:14
So my C code segfaults. Nothing new or interesting about that, let's just sprinkle the code with printfs and fire up gdb.
Oh wait, it segfaults WITHIN FUCKING malloc.
I call
malloc(24)
and the bitch just segfaults. What the fuck. (Yes, it's glibc)
GNU QUALITY
2
Name:
Anonymous
2011-11-14 17:24
malloc considered harmful.
Use C++ instead.
3
Name:
Anonymous
2011-11-14 17:27
>>2
Because your precious new doesn't call malloc somewhere deep inside all that shit.
4
Name:
Anonymous
2011-11-14 17:36
If you don't need a lot of memory and/or complicated management, you can implement your own malloc that allocs from an extern array.
5
Name:
Anonymous
2011-11-14 18:44
Perhaps you are allocating more memory than the machine can spare, or perhaps you are leaking memory.
6
Name:
Anonymous
2011-11-14 18:48
>>1
That's because you have doubly free'd a pointer or stepped out of bounds of a previously allocated array before calling malloc.
This typically happens when you have forgotten a
sizeof in a previous malloc.
Note that these lead to undefined behavior which includes a segmentation fault in your malloc call.
7
Name:
Anonymous
2011-11-14 18:56
>>6
Yes, you are right. I'm retarded. I'd like to apologise to everyone involved in GNU project.
8
Name:
rms
2011-11-14 19:02
9
Name:
Anonymous
2011-11-14 19:21
>>1
Get back to the imageboards.
10
Name:
Anonymous
2011-11-14 19:55
/b/ i owe you
11
Name:
Anonymous
2011-11-14 21:25
CHECK MY DUBZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
12
Name:
Anonymous
2011-11-14 21:32
Only through GNUPAIN can one attain GNUFREEDOM .
13
Name:
Anonymous
2011-11-14 22:32
This happens on Windows' CRT too if you corrupt the block headers in the wrong way.
14
Name:
Anonymous
2011-11-15 1:00
>>7
You haven't met drpepper yet have you?
15
Name:
FrozenVoid
!!mJCwdV5J0Xy2A21
2011-11-15 2:12
if you want exact 24 bytes why don't use a static array?
If its used in a function you can make it a global first like
char somearray[24]; and assign values to it in functions or inside main. Problem solved
16
Name:
Anonymous
2011-11-15 2:35
>>15
I, of course, was calling it with sizeof some struct (of size 24). I put 24 there just to be clear that I don't try to allocate something stupid.
17
Name:
Anonymous
2011-11-15 3:13
>>16
char buffa[sizeof(dicks)];