控件永远不会从malloc()返回 [英] Control never returns from malloc()

查看:77
本文介绍了控件永远不会从malloc()返回的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我有一些代码永远不会从对malloc()的调用中返回,是否b / b
有人有任何想法吗?系统上有足够的可用内存。

这是在Linux内核2.4.20中运行的。代码已在几台不同的Linux机器上运行。这个相同的代码在Mac OS X上运行时没有任何

问题。


这是GDB日志:

(gdb)步骤

1160 hungarian_schedule =

malloc(SCHEDULER_NUM_SLOT * simParams.NUM_LAMBDAS * si zeof(int));

(gdb)print 180 * simParams。 NUM_LAMBDAS * sizeof(int)

$ 7 = 1440

(gdb)步骤


程序接收信号SIGINT,Interrupt。 0x42074d44

(gdb)


我点击了CTRL-C停止代码,这是因为它显示了在malloc_consolidate()中断了




任何帮助将不胜感激。


谢谢,


Michael

解决方案

7 = 1440

(gdb)步骤


程序收到信号SIGINT,中断。
来自/ lib / tls / libc的malloc_consolidate()中的
0x42074d44 .so.6

(gdb)


我点击CTRL-C来停止代码,那就是它显示在malloc_consolidate()中断了




任何帮助都将非常感谢。


谢谢,


Michael


"迈克尔玛蒂" < MI ************* @ gmail.com>写道:

我有一些代码永远不会从对malloc()的调用返回,是否有人有任何想法?系统上有足够的可用内存。




您的代码中可能存在错误。例如,您可能会在已分配块的末尾写入
。尝试一个内存

调试器,例如在x86 / Linux上的valgrind。

-

适合主人的适合新手。

你必须明白超越结构之前的道。

- 编程之道




Michael McGarry写道:< blockquote class =post_quotes>

我有一些代码永远不会从对malloc()的调用返回,


您保守秘密的代码那些可能能够调试它的人。

有没有人有任何想法?




向我们展示代码?


Brian


Hi,

I have some code that never returns from a call to malloc(), does
anyone have any ideas? There is plenty of free memory on the system.
This is running in Linux kernel 2.4.20. The code has been run on
several different Linux machines. This same code runs without any
problems on Mac OS X.

Here is the GDB log:
(gdb) step
1160 hungarian_schedule =
malloc(SCHEDULER_NUM_SLOT*simParams.NUM_LAMBDAS*si zeof(int));
(gdb) print 180*simParams.NUM_LAMBDAS*sizeof(int)
$7 = 1440
(gdb) step

Program received signal SIGINT, Interrupt.
0x42074d44 in malloc_consolidate () from /lib/tls/libc.so.6
(gdb)

I hit CTRL-C to stop the code and that is when it displays that
interrupted in malloc_consolidate().

Any help would be greatly appreciated.

Thanks,

Michael

解决方案

7 = 1440
(gdb) step

Program received signal SIGINT, Interrupt.
0x42074d44 in malloc_consolidate () from /lib/tls/libc.so.6
(gdb)

I hit CTRL-C to stop the code and that is when it displays that
interrupted in malloc_consolidate().

Any help would be greatly appreciated.

Thanks,

Michael


"Michael McGarry" <mi*************@gmail.com> writes:

I have some code that never returns from a call to malloc(), does
anyone have any ideas? There is plenty of free memory on the system.



There is probably a bug in your code. For example, you might be
writing beyond the end of an allocated block. Try a memory
debugger, e.g. valgrind on x86/Linux.
--
"What is appropriate for the master is not appropriate for the novice.
You must understand the Tao before transcending structure."
--The Tao of Programming



Michael McGarry wrote:

Hi,

I have some code that never returns from a call to malloc(),
Code which you keep a secret from those who might be able to debug it.
does anyone have any ideas?



Show us the code?

Brian


这篇关于控件永远不会从malloc()返回的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆