Hello, I was recently looking through some of my code and found what I believe to be a memory leak. It is in a function that appends two strings and I am not sure how to resolve it. Here is the function: const char *strapp(const char *str,const char *s) { int size,strSize,sSize; for (strSize=0;str[strSize];++strSize); for (sSize=0;s[sSize];++sSize); size=strSize+sSize; char *ret=new char[size+1]; for (size_t i=0; i<strSize; ++i) ret[i]=str[i]; for (size_t i=0; i<sSize; ++i) ret[strSize+i]=s[i]; ret[size]=0; return ret; } Note that this includes a `new` operator but would leave it up to the untrustworthy user of the function to `delete` the resulting pointer …

Member Avatar
Member Avatar
+0 forum 7

Back in December 2011, reports were circulating regarding a data breach at one of the big Chinese social networking sites, Tianya.cn that suggested the login credentials of some 40 million users were potentially exposed. Clear text usernames and password combinations were stolen by hackers during the breach, although a Tianya spokesperson at the time said that only those users who registered before November 2009 would have had clear text logins as after that the service had implemented encryption (!) - quite why the existing membership data could not have been encrypted at this point is, frankly, beyond me. Word on …

Member Avatar
Member Avatar
+0 forum 2

Hi all! I'm trying to create a program that produces a memory leak. I have a program that looks like it works, but I was wanting to verify whether it actually is causing a memory leak, and that it's not just some other type of issue. It's in C++, which is a language I have very little experience in. I've mostly used C#, but as it is garbage collected I thought that it may be easier to use a different language. My code is as follows: void memLeak() { int *data = new int; *data = 15; int *data1 = …

Member Avatar
Member Avatar
+0 forum 4

I have been making a C++ application and currently checking if there exists any memory leak before release. My application will be running as an object over HTTP server and it should be idle until an HTTP request comes in. Which means it should release most of memories when it's idle. When I checked it using "Visual Leak Detector", there was no memory leak detected and everything was clean. But when I open "Windows Task Manager" and run the program, the amount of memory in Processes tab keeps increasing everytime HTTP request comes in. (it never decreases after a task …

Member Avatar
Member Avatar
+1 forum 4

In my project, I have created around 12 custom controls(checkbox,radiobutton,editbox,progressbar,scrollbar,button etc...). Custom painting is done in all controls for the extended look and feel using Pen,Brushes,Graphics, GraphicPath,Images,Region and Bitmaps ect. After the use of these objects, I have disposed the objects using the Dispose() method. I am using these controls in a System.Windows Form. When I am contiously showing and closing the Form causes an increase in the GDI objecs each time. I have checked the GDI object count using Task Manager and confirmed the GDI leak in the form. My question is, how can I manage this GDI leak? …

Member Avatar
Member Avatar
+0 forum 3

Acronis responds to DaniWeb questions regarding a leak of customer data which, [as we exclusively reported over the weekend](http://www.daniweb.com/hardware-and-software/microsoft-windows/viruses-spyware-and-other-nasties/news/427455/breaking-acronis-blames-technical-issue-for-customer-data-leak), resulted in some information being indexed by search engines and accessible to anyone on the Internet. ![dweb-acronis2](/attachments/small/0/dweb-acronis2.jpg "align-right") Although the leak itself was identified by Acronis on Friday 29th June, the email informing those customers whose data was included in the spreadsheet that ended up exposed only went out late in the day on Friday 6th July. DaniWeb itself was only made aware of the problem, by one of those customers, on Saturday morning. As a result, contacting someone at Acronis …

Member Avatar
Member Avatar
+2 forum 1

currently I'm rewriting old euler solutions into classes so i can store them in a library. I wrote a program that digitizes a number so it can check to see if it a pallindrome, The base class digitize dynamically allocates memory for the size of a number and stores each digit, My second class pallindrome inherits the members of digitize, and refrences the constructor using the :, however when I construct the pallindrome class i get a back trace error. I know I can probably just not use inheritance and it will work but i want to know why this …

Member Avatar
Member Avatar
+0 forum 2

Hi everyone! I have written a server client that receives information, does a database transaction and then sends the result back to the client. My client has requested that they be able to view what was received and what was sent in real time. I have used a JTextArea. The problem came in when I was doing some stress testing on the app. As soon as the number of requests hit about 150k, I noticed that it was using a lot of RAM. I wrote a method to clear the text area (setText(null) and tried setText("")). When the button was …

Member Avatar
Member Avatar
+0 forum 3

I was going to start a rumor, but apparently since you all know I'm a team member, that just ruins the fun. So like our good friends at Apple do, I'm starting a controlled leak. Here's the details: DaniWeb Contest We're going to run a month long contest. There's going to be a many winners. More details to follow.

Member Avatar
Member Avatar
+0 forum 10

I am pretty new to C#. I am a Borland c++ developer and is used to "newing" and "deleting" objects programmatically. I understand that with C# the garbage collector is responsible for the deleting of objects. It seems though that I have a memory leak. I am developing a SQLServerDBInterface class (which I can easily use / include in other future projects). What I notice is that when I call my custom DBConnect function the memory (in task manager for this C# process) increases with a couple of bytes everytime. Could you please have a look at this code and …

Member Avatar
Member Avatar
+0 forum 6

Hi all , here is my code for GET request to a http site, but it keeps taking memory nor releasing it, here is the code: [CODE] while(1) { hSession = WinHttpOpen( L"Mozilla/5.0 (Windows NT 6.1; rv:5.0) Gecko/20100101 Firefox/5.0", WINHTTP_ACCESS_TYPE_DEFAULT_PROXY, WINHTTP_NO_PROXY_NAME, WINHTTP_NO_PROXY_BYPASS, 0); if (hSession) hConnect = WinHttpConnect( hSession, L"lalala.com", INTERNET_DEFAULT_HTTP_PORT, 0); hRequest = WinHttpOpenRequest( hConnect, L"GET", L"/", L"HTTP/1.1", WINHTTP_NO_REFERER, WINHTTP_DEFAULT_ACCEPT_TYPES, 0); bResults = WinHttpSendRequest( hRequest, L"Content-Type: application/x-www-form-urlencoded", -1, WINHTTP_NO_REQUEST_DATA, 0, 0, 0); if (bResults) bResults = WinHttpReceiveResponse( hRequest, NULL); hRequest = WinHttpOpenRequest( hConnect, L"GET", L"/forum/index.php?s=viewforum", L"HTTP/1.1", WINHTTP_NO_REFERER, WINHTTP_DEFAULT_ACCEPT_TYPES, 0); bResults = WinHttpSendRequest( hRequest, L"Content-Type: application/x-www-form-urlencoded", -1, WINHTTP_NO_REQUEST_DATA, 0, 0, …

Member Avatar
Member Avatar
+0 forum 3

Hi to all, I have a severe problem with memory when executing my application. At start it merely uses about 14.000 K without doing anything. Then, when the main code starts in a seperate thread, it spikes up to 700.000 K (observed in TaskManager). Program in question is an implementation of Run-Length Encoding compression technique (part of my diploma paper). The code itself is rather complex but it works as intended (besides the huge memory leak). The memory leak occured while I was testing it on a 4 MB file so if you guys and gals know of any general …

Member Avatar
Member Avatar
+0 forum 9

The exception is: Unhandled exception at 0x6474f269 in Loliboll.exe: 0xC0000005: Access violation reading location 0x0000000c. I think it's a memory leak. I tried to solve it obviously, but to no prevail. This is the code: [CODE]#include "stdafx.h" using namespace std; int main() { // FreeConsole(); int a; // INTRO = 1; // MENU = 2; // INGAME = 3; elf_handle gui = elfCreateTextureFromFile("startup.png"); elfSetGui(gui); elfInitWithConfig("config.txt"); elf_handle scn = elfLoadScene("level1.pak"); elf_handle cam = elfGetCameraByName(scn, "Camera"); elf_handle tex = elfCreateTextureFromFile("startup.jpg"); elf_handle pic = elfCreatePicture("MyPicture"); elfHideMouse(true); //Sets the default state to be the intro state. a = 1; elf_handle timer = elfCreateTimer(); elfStartTimer(timer); …

Member Avatar
Member Avatar
+0 forum 2

I am using Visual C++ Express Edition on Windows, and I am look at the windows task manager and I noticed that every second, in the process tab the memory of my C++ program increases about 8 K when I am not even doing anything. Also, I've noticed that if I comment my whole drawing code with glEnd and glBegin, it stop adding that 8 K per second but adds 4 K every time I move the mouse. I am using OpenGL for drawing and SDL for windows management. Please note, I loaded one texture and I am drawing in …

Member Avatar
Member Avatar
+0 forum 5

Hi, I have a C# pdf library called PdfSharp which I use to create PDFs. I have a page (print.aspx) which instantiats the class which creates the pdf in the Page_Load() event handler. for some reason when I am running this through IIS, the process for the app pool (w3wp.exe) keeps using more and more memory. Initially (on first run after a recycle of app pool) the memory usage is about 10mb, then I run print.aspx page and the memory usage goes up to around 70mb (which I assume most of is the .dlls being loaded into memory etc.?) and …

Member Avatar
Member Avatar
+0 forum 8

[ATTACH=right]16135[/ATTACH]A day after Wikileaks dropped one of the biggest leaked bombshells on the U.S. government, perhaps since the Pentagon Papers, typing wikileaks.org into a browser is likely to get you nothing more than a blank browser window. The somewhat mysterious collective site released over 91,000 secret reports related to the Afghan War that paint a bleak picture of the war effort. The New York Times, (UK) Guardian and Germany's Der Spiegel were given access to the documents a month previous to their going live on Wikileaks. The New York Times released its reporting on the document on Sunday. The posting …

Member Avatar
+0 forum 0

I have been running this application for some time and have just recently begun to receive this error message. I would be eternally grateful if someone could shed some light on what causes this error or it's possible sideffects. [CODE]04/27/2010 00:06:16.016 [ERROR] com.ghd.domain.GHSessionFactory.createSession(GHSessionFactory.java:129) - An open thread session is being replaced. This will cause connection leaks and needs immediate attention! java.lang.Exception[/CODE]

Member Avatar
+0 forum 0

Hello, This might not appear like a programming question, but inherently deals with code. I have a following piece of test-code, which has obvious errors like array index out of bounds, memory leak:- [CODE] #include "stdio.h" #include "stdlib.h" main() { int i; char *ptr; ptr = (char*)malloc(5); for(i=0;i<10;i++) { ptr[i]=(char)i; } }[/CODE] This code is built on a MS-Visual Studio 2008. I am trying to use Rational Purify (version 7.0) to identify run-time errors, memory leaks in my code. Towards after reading some pointers about how to build code for usage in Purify, i have done below things in the …

Member Avatar
Member Avatar
+0 forum 2

Can't figure out what's wrong with my delete function. If I remove the delete for the name and address it works as expected, but am I not leaking memory that way? [B]Structs:[/B] [CODE] struct Person { char* name; char* address; int zipcode; }; struct Node { Person* per; // Person structure from earlier problem Node* prev; // address of the Node previous to this one Node* next; // address of the Node after this one }; struct NodeList { Node* head; Node* tail; int size; };[/CODE] [B]Init a Node:[/B] [CODE]Node * newNode = new Node; Init(newNode);[/CODE] [CODE]void InitNode(Node * node) …

Member Avatar
Member Avatar
+0 forum 8

I'm working on a .NET application that loads web pages using multiple WebBrowser controls. There are several threads and WebBrowser controls involved (this is a server application, and the WebBrowser is required for capturing the rendered image), each thread creating a WebBrowser control and running a message loop for it. My question/issue is related to the WebBrowser control. Every time a web page is loaded, the (Windows) handle usage for the process increases. The WebBrowser controls are disposed when no longer needed, but for some reason the handle count doesn't seem to decrease. The application handle usage grows to more …

Member Avatar
+0 forum 0

Firefox ticks many boxes, but the one big cross it has had to bear over the years is the memory leakage problem that many users have experienced. Here's how it works: user has Firefox browser open and visits websites, Firefox slurps up some system resources, user continues to keep Firefox running, Firefox continues to slurp up ever increasing amounts of precious system resources. Well, that has been the allegation at least, and one which Mozilla has been long at pains to deny. Whenever the subject has cropped up, the official response has always been that there is simply no significant …

Member Avatar
Member Avatar
+0 forum 1

The Mozilla Corporation announced tonight in a media alert that tomorrow it will be releasing an updated version of its Firefox web browser, which has sent for-profit rivals, including Microsoft, scurrying to hang onto market share. Although Mozilla Corp says that official details of Firefox 1.5 will be released Tuesday morning, the media alert reported that the new software "builds upon the success of its predecessor to deliver an improved browser with significant performance and usability upgrades." Enhancements were made to the browser's security, privacy, and customization options as well, the alert says. The Mozilla Corporation is a subsidiary of …

Member Avatar
Member Avatar
+0 forum 1

The End.