cc

Odd segmentation fault with CC/GCC but not G++ (C/SDL2/Linux)

被刻印的时光 ゝ 提交于 2019-11-26 23:25:50
问题 The code posted is copied directly from an example of a popular SDL2 tutorial, to ensure that it wasn't I who had made some silly mistake. All I've done to the example is changing the path of the image file in question, I changed type bool to int, false to 0 and true to 1. As I understand it, nothing C++ specific should remain. Everything seems to work regardless what I do, but when compiling with CC/GCC (I suppose that's really the same deal) I get a segmentation fault in the very end, I

Problem usage memory in C

我只是一个虾纸丫 提交于 2019-11-26 17:49:45
问题 Please help :) OS : Linux Where in " sleep(1000);", at this time "top (display Linux tasks)" wrote me 7.7 %MEM use. valgrind : not found memory leak. I understand, wrote correctly and all malloc result is NULL. But Why in this time "sleep" my program NOT decreased memory ? What missing ? Sorry for my bad english, Thanks ~ # tmp_soft For : Is it free?? no Is it free?? yes For 0 For : Is it free?? no Is it free?? yes For 1 END : Is it free?? yes END ~ #top PID USER PR NI VIRT RES SHR S %CPU