问题标签 [inline-c]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
123 浏览

perl - Perl Inline::C default flags

I made a module using Inline::C and I noticed some unexpected performance discrepancies between running it on the host MacOS vs a guest Linux VM. Looking into it, it was due to the default C compiler flags being different. On MacOS they appear to be:

Vs on Centos 7:

The main difference for my code is O3 vs O2, so I looked into the Inline docs and used:

To explicitly specify -O3. Well, the result is that -O3 -O2 is applied that way, so specifying ccflags does not overwrite the default, it just adds before them, which in the end does not have any effect. Any idea where the default comes from and/or how to overwrite it to specify the optimization level that I want.

0 投票
1 回答
139 浏览

c++ - 我的 Perl XS 代码中的内存泄漏在哪里?

我有一个用 C++ 编写并使用 Inline::CPP 从 Perl 执行的大型程序。该代码似乎使用了大量内存,所以我假设存在某种泄漏。我编写了以下代码来重现相同的问题,但要简单得多。当我循环代码 1,000,000 次以测试代码的性能时,我发现了泄漏。这个简单的 Perl 脚本使用 828MiB,而我的完整程序使用 1.3GiB。

我已经尝试了很多东西,比如在代码中的各种变量上使用SvREFCNT_decnewRV_noincsv_freesv_2mortal,但我无法降低内存使用量。

这是我的示例代码: