 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Norbert Leister Guest
|
Posted: Wed May 02, 2007 9:11 am Post subject: malloc call not returning |
|
|
Hi NG,
I've the problem, that a malloc call is not returning.
<source-snip>
printf("a\n");
my_pointer = (struct_pointer)malloc(struct_size); /*size 1420*/
printf("b\n");
</source-snip>
I'm almost sure, that my program frees some memory, but if there is no
memory, the malloc should return some NULL-pointer.
The 'normal' output of the function is 'a' and 'b'. But sometimes (after
a while of running), the program stops after printing the 'a'. The other
threads of the programm are still responding to commands, but the one
who called the malloc does not reacts.
Have you somewhere had a similar problem?
Compiler: gcc-3.3.3-7 on Fedora Core 2
Greeting:
Norbert |
|
| Back to top |
|
 |
Ian Collins Guest
|
Posted: Wed May 02, 2007 9:11 am Post subject: Re: malloc call not returning |
|
|
Norbert Leister wrote:
| Quote: |
Hi NG,
I've the problem, that a malloc call is not returning.
source-snip
printf("a\n");
my_pointer = (struct_pointer)malloc(struct_size); /*size 1420*/
printf("b\n");
/source-snip
I'm almost sure, that my program frees some memory, but if there is no
memory, the malloc should return some NULL-pointer.
The 'normal' output of the function is 'a' and 'b'. But sometimes (after
a while of running), the program stops after printing the 'a'. The other
threads of the programm are still responding to commands, but the one
who called the malloc does not reacts.
Have you somewhere had a similar problem?
Compiler: gcc-3.3.3-7 on Fedora Core 2
Attach your debugger and see what the application is doing. |
--
Ian Collins. |
|
| Back to top |
|
 |
Peter Nilsson Guest
|
Posted: Thu May 03, 2007 9:11 am Post subject: Re: malloc call not returning |
|
|
Richard Heathfield <r...@see.sig.invalid> wrote:
| Quote: | Flash Gordon said:
...
You are still using the wrong tool for the job. If you
want you[r] C code analysed use a tool designed to
analyse C code, not a tool designed to compile C++
code.
No, Flash, he's right - if he wants more warnings, using a
compiler for a different language is a great way to get
them. Personally, for this purpose I can wholeheartedly
recommend using a COBOL compiler.
|
If only you had recommended that to dmr 20 years ago.
--
Peter |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|