memory-leaks

How can I know if Leak Sanitizer is enabled at compile time?

点点圈 提交于 2019-12-23 15:51:06
问题 The GCC and Clang compilers both have support for LeakSanitizer which helps finding memory leaks in C programs. Sometimes a memory leak is unavoidable (because it is being tested in a test suite for example). Such memory can be annotated using the Leak Sanitizer interface: #include <sanitizer/lsan_interface.h> void *p = create_new_object(); __lsan_ignore_object(p); This will however break on compilers that do not support LSan. In Address Sanitizer, this construct can be used to detect the

TBB possible memory leak

℡╲_俬逩灬. 提交于 2019-12-23 14:56:50
问题 Test program: #include <tbb/parallel_invoke.h> int main(void) { tbb::parallel_invoke([]{},[]{}); return 0; } Compiled using g++ -std=c++11 tmp.cpp -ltbb Checked with valgrind --tool=memcheck --track-origins=yes \ --leak-check=full --log-file=report ./a.out` libtbb version: 4.0 , valgrind version: 3.8.1 . Part of the above test result: possibly lost: 1,980 bytes in 6 blocks Question is: Is this a TBB bug? Or is this possible lost actually safe, it's just some codes that valgrind does not

Unaligned memory access: is it defined behavior or not? [duplicate]

十年热恋 提交于 2019-12-23 14:23:41
问题 This question already has an answer here : What does the standard say about unaligned memory access? (1 answer) Closed last year . Consider the following code: #include <iostream> int main() { char* c = new char('a'); char ac[4] = {'a', 'b', 'c', 'd'}; unsigned long long int* u = reinterpret_cast<unsigned long long int*>(c); unsigned long long int* uc = reinterpret_cast<unsigned long long int*>(&ac[3]); *u = 42; *uc = 42; std::cout<<*u<<" "<<*uc<<std::endl; } Is this considered as a valid

Unaligned memory access: is it defined behavior or not? [duplicate]

偶尔善良 提交于 2019-12-23 14:21:06
问题 This question already has an answer here : What does the standard say about unaligned memory access? (1 answer) Closed last year . Consider the following code: #include <iostream> int main() { char* c = new char('a'); char ac[4] = {'a', 'b', 'c', 'd'}; unsigned long long int* u = reinterpret_cast<unsigned long long int*>(c); unsigned long long int* uc = reinterpret_cast<unsigned long long int*>(&ac[3]); *u = 42; *uc = 42; std::cout<<*u<<" "<<*uc<<std::endl; } Is this considered as a valid

Memory Leak using an UIAlertController in Swift

不羁的心 提交于 2019-12-23 13:21:00
问题 I present a simple UIViewController using this simple code @IBAction func addNewFeed(sender: UIBarButtonItem) { var alertView: UIAlertController? = UIAlertController(title: NSLocalizedString("New Feed", comment: "Titolo popup creazione feed"), message: NSLocalizedString("Insert the Title and the Link for the new Feed.", comment: "Messaggio creazione nuovo feed"), preferredStyle: UIAlertControllerStyle.Alert) alertView!.addAction(UIAlertAction(title: NSLocalizedString("Cancel", comment:

MPI_REDUCE causing memory leak

只谈情不闲聊 提交于 2019-12-23 13:15:35
问题 I have recently encountered a weir behavior. If I run the following code on my machine (using the most recent version of cygwin, Open MPI version 1.8.6) I get a linearly growing memory usage that quickly overwhelms my pc. program memoryTest use mpi implicit none integer :: ierror,errorStatus ! error codes integer :: my_rank ! rank of process integer :: p ! number of processes integer :: i,a,b call MPI_Init(ierror) call MPI_Comm_rank(MPI_COMM_WORLD, my_rank, ierror) call MPI_Comm_size(MPI_COMM

Memory leak when using setText

风格不统一 提交于 2019-12-23 13:15:07
问题 I have noticed that I have a memory leak in my program. I have traced the problem to the line. Clock.setText("" + h + ":" + df.format(m) + ":" + df.format(s)); I have googled this and it seems to be a common problem but I have not found an answer. Does anyone know a fix? Here is the entire code: package CodeBits; import java.awt.Color; import java.awt.EventQueue; import java.awt.Font; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import java.awt

RenderTargetBitmap Memory Leak

拥有回忆 提交于 2019-12-23 13:12:34
问题 am trying to render an image with RenderTargetBitmap every time i create an instance from RenderTargetBitmap to render image the memory increased and when am done the memory never released and this is the code : RenderTargetBitmap rtb = new RenderTargetBitmap((int)(renderWidth * dpiX / 96.0), (int)(renderHeight * dpiY / 96.0), dpiX, dpiY, PixelFormats.Pbgra32); DrawingVisual dv = new DrawingVisual(); using (DrawingContext ctx = dv.RenderOpen()) { VisualBrush vb = new VisualBrush(target); ctx

Is this a memory leak ( a program in python with sqlalchemy/sqlite)

天大地大妈咪最大 提交于 2019-12-23 12:58:02
问题 I have the following code runs over a large set of data (2M). It eats up all my 4G mem before finishing. for sample in session.query(CodeSample).yield_per(100): for proj in projects: if sample.filename.startswith(proj.abs_source): sample.filename = "some other path" session.add(sample) Then I ran it though a reduced set of data and analyzed heap with heapy. get_rp() gave me the folloing hint 0: _ --- [-] 47821 (0x9163aec | 0x9165fec | 0x916d6cc | 0x9251414 | 0x925704... 1: a [-] 8244 tuple:

I need more info about Puppeteer page.metrics and queryObjects

▼魔方 西西 提交于 2019-12-23 12:54:45
问题 I'm using Puppeteer to find a memory leak issue. I'm using puppeteer's page.metrics() API but I am having trouble understanding each properties meaning. All my values in the metrics keep increasing in value over time. Is this expected? Or is this an indication that there might be a serious memory leak? The properties which are growing in value as the app runs are: JSEventListeners, Nodes, LayoutCount, RecalcStyleCount, LayoutDuration, RecalcStyleDuration, ScriptDuration, TaskDuration,