How can I detect if a program is running from within valgrind?

Is there a way to identify at run-time of an executable is being run from within valgrind? I have a set of C++ unit tests, and one of them expects std::vector::reserve to throw std::bad_alloc. ...

What is the best Distributed Brute Force countermeasure?

First, a little background: It is no secret that I am implementing an auth+auth system for CodeIgniter, and so far I'm winning (so to speak). But I've run into a pretty non-trivial challenge (one...

manipulation of Vectors created with new

Can anyone help with this... vector<unsigned int> *vVec = new vector<unsigned int>; vVec .reserve(frankReservedSpace); start = std::clock(); for(int f=0; f<sizeOfvec; f++) ...

boost::shared_ptr and multithreaded access

I'm trying to implement a multithreaded framework, in which output objects are created at the end of every frame that my networking thread runs, so that another thread can, at the beginning of its...

Why does not C# support operator overloading with pass by reference?

Is this a CLR restriction or a language design decision? I tried to do it in C++/CLI, of course where it works because the need to support native c++: public ref class Test { public: static...

Output unicode strings in Windows console app

Hi I was trying to output unicode string to a console with iostreams and failed. I found this: Using unicode font in c++ console app and this snippet works. SetConsoleOutputCP(CP_UTF8); wchar_t...

Critique my heap debugger

I wrote the following heap debugger in order to demonstrate memory leaks, double deletes and wrong forms of deletes (i.e. trying to delete an array with delete p instead of delete[] p) to...

Critique my non-intrusive heap debugger

This is a follow-up to Critique my heap debugger from yesterday. As suggested by bitc, I now keep metadata about the allocated blocks in a separate handwritten hashtable. The heap debugger now...

Heap Behavior in C++

Is there anything wrong with the optimization of overloading the global operator new to round up all allocations to the next power of two? Theoretically, this would lower fragmentation at the cost...

How to return a reference in C++

If for example I create a new object in a function and I want to return its reference how can I do it? Lets say I got an IntClass that has a 'int num' field in the private. So i want to create a...

C++ HEAP error when delete [] is called

I keep getting the error in VS 2100 "CRT detected that the application wrote to memory before start of heap buffer" Can anyone help? My int Main is all the way on the bottom. The error occur when...

Error occurring when trying to compare two .txt images in C++

As part of my University assignment we are required to compare two images in the form of .txt one is the normal image, the other is a jumbled version of the image. Both images are 512x512 and we...

String Class c++ Heap Errors

I made my own class string it has two attributes buff to store string and length when i compile my code without it works fine but if i use it String as an object i get alot of errors what is...

Does delete[] work slower than new[]?

I've been running tests using gprof on a simple version of a vector which allocates memory on the heap (without actually being dynamic - tests purposes only). The thing is that looking at the...

Initialize Object with Pointer Members in a Vector c++

I would like to be able to call a non-trivial constructor on an object when I use the push_back() method. Instead, all I have been able to do is pass a shallow copy of an object to the vector....

Type 'URLSearchParams' is not assignable to type 'URLSearchParams'

I want to send a http.get request with some search parameters to my webapi to get a list of students. I found some examples on how to do this, but after doing exactly as in the examples, I get...

Ionic2 Error: "No provider for Storage"

After reading everything I could find, and failing, I must ask here: I am trying to use ionic2's Storage, just like the doc tells me to, doc: https://ionicframework.com/docs/storage/ here is my...

Angular - Connects to Proxy server and gets response but then shows Error occured while trying to proxy to: localhost to actual server

I'm new to Angular(2,4). I was trying to connect to proxy server. Added proxy.config.json in project root directory { "/api/*": { "target": "http://<server_ip_address>:<port>", ...

For a TPL Dataflow: How do I get my hands on all the output produced by a TransformBlock while blocking until all inputs have been processed?

I'm submitting a series of select statements (queries - thousands of them) to a single database synchronously and getting back one DataTable per query (Note: This program is such that it has...

ARM GCC heap not fully used

I am setting up my Cortex-M4 platform to use heap memory and encountering some issues. I set heap region size to be 512 bytes, and it only allocates 9 bytes. Then I set heap to be 10kB and it can...

What is the meaning of left angle bracket hyphen (<-) in Swift?

I am new to Swift and first time seeing the use of back arrow followed with a hyphen in Swift. I can guess this is assigning a value in the following code, but why can't it just use the equal sign...

Operator '+' cannot be applied to types 'T' and 'T'. in TypeScript

I am very new to TypeScript. My TypeScript version is 3.7.5. IMHO, it should be very easy, but I don't know why it does not work. function add<T> (a:T, b:T):T { return a + b...

ESLint howto fix parsing error: 'import' and 'export' may only appear at the top level

NOTE: The Code is working, only ESLint is giving me an error which I want to fix!! When doing a dynamic import: if (true) import x from 'y'; //Parsing error: 'import' and 'export' may only appear...

SwiftUI - make sure to publish values from the main thread (via operators like receive(on:)) on model updates

My app contains a resource heavy operation that populates an Array based on data pulled from an XML feed. I do not want this operation to lock up the main thread (and the UI when the array is...

using $function new operator in MongoDB for updateMany failed

I have an array tree and I want to update that array in my collection with this syntax db.documents.updateMany( { companyId: ObjectId("5f29074048538b6403bc71ab", tree: { $in:...

WebFlux DataBufferLimitException: Part headers exceeded the memory usage limit of 8192 bytes

When uploading a csv file and a JSON object at the following endpoint @PostMapping(value = "dataset/rows/query", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) Mono<List<Integer>>...

try/catch not working on network image (Exception: Invalid image data)

I have get network image and used ternary operator where I can show network image but unable to show default asset image where network image is invalid default image in grid also as this- I am...

Airflow 2 : get execution date inside task

I used to create tasks with the python operator and retrieve execution in airflow 1 as follow def task(**kwargs): date = kwargs['execution_date'] What is the correct way to do it with the...

Use localStorage.getItem() with typescript

I have the following line of code: const allGarments = teeMeasuresAverages || JSON.parse(localStorage.getItem("teeMeasuresAverages")) || teeMeasuresAveragesLocal; Typescript throws this...

! LaTeX3 Error: Mismatched LaTeX support files detected. (LaTeX3) Loading 'expl3.sty' aborted! (LaTeX3)

I can't compile my R Markdown files with knitr. The error message I get is the following: ! LaTeX3 Error: Mismatched LaTeX support files detected. (LaTeX3) Loading 'expl3.sty'...