Overview
Features
Download
Documentation
Community
Add-Ons & Services

memory deallocation problem

Please post support and help requests here.

memory deallocation problem

Postby Sahlan » 07 Aug 2013, 11:29

I have designed some HttpClient and Socket classes which I implement for Linux and OSX using POCO classes, and which I implement for Windows using Microsoft libraries. These classes have been performing well, without problem, on all these environments. I decided it would be consistent if I used POCO to implement the classes on Windows also. This could be done as simply as changing a #define to so that the POCO implementation, instead of the Win32 implementation, was compiled and linked in on Windows, and since I had built a successful Windows demo program of classes that used POCO for a client recently, I thought the changeover would be straightforward.

Unfortunately when I run my code and it happens to go into Poco's Socket:: select, on returning from that function there is an exception thrown in a deallocate of a std::vector used internally by the Poco function. Now I know this doesn't necessarily mean there is a fault in Poco, it could be some subtle memory corruption in my own code that is causing the issue, but since this is established code for a large application that is running across a variety of environments without any problems, I am wondering if this isn't a build environment issue, some obvious problem that I may have overlooked. The details are: on Windows I build using Visual Studio 2005; Poco built using supplied cmd file; Linking dynamically; Same problem on debug and release mode builds ; Same problem whether memory checking macros on new and delete are turned on or off ; Build flags are matched to those of my application; Same problem whether linked to the latest stable release of poco, or the slightly earlier 1.4.3p1 that I am using; vector memory deallocation problem does not occur anywhere std::vector is used in my own code.

At least I can get into the poco code with the debugger, but before I do that I wonder if anyone else has come across this problem or can suggest something I might have forgotten to check.
Sahlan
 
Posts: 1
Joined: 07 Aug 2013, 11:04

Re: memory deallocation problem

Postby hgfju » 23 Sep 2014, 13:36

I am facing the exact same problem.
Has anyone else seen this?

A call to Poco::Net::Socket::select() makes my application crash. I am linking dynamically with poco.
The call to select() is done from my TCPServer's run() method.If I create temporary socket and select() on it, everything is good, but as soon as I add "this->socket()" in the list, I get a crash

PocoNetd.dll!std::allocator<Poco::Net::Socket>::deallocate(Poco::Net::Socket * _Ptr, unsigned int __formal) Line 182 C++
PocoNetd.dll!std::vector<Poco::Net::Socket,std::allocator<Poco::Net::Socket> >::_Tidy() Line 1309 C++
PocoNetd.dll!std::vector<Poco::Net::Socket,std::allocator<Poco::Net::Socket> >::~vector<Poco::Net::Socket,std::allocator<Poco::Net::Socket> >() Line 706 C++
PocoNetd.dll!Poco::Net::Socket::select(std::vector<Poco::Net::Socket,std::allocator<Poco::Net::Socket> > & readList, std::vector<Poco::Net::Socket,std::allocator<Poco::Net::Socket> > & writeList, std::vector<Poco::Net::Socket,std::allocator<Poco::Net::Socket> > & exceptList, const Poco::Timespan & timeout) Line 324 C++
SomeService.dll!SomeService::Server::run() Line 155 C++
PocoNetd.dll!Poco::Net::TCPServerConnection::start() Line 65 C++
PocoNetd.dll!Poco::Net::TCPServerDispatcher::run() Line 137 C++
PocoFoundationd.dll!Poco::PooledThread::run() Line 215 C++
PocoFoundationd.dll!Poco::ThreadImpl::runnableEntry(void * pThread) Line 245 C++
hgfju
 
Posts: 2
Joined: 23 Sep 2014, 13:31

Re: memory deallocation problem

Postby hgfju » 23 Sep 2014, 17:23

Problem solved.

I was linking against the wrong DLLs. My project was built with VS2013 and I was linking with DLLs built with VS2010.
hgfju
 
Posts: 2
Joined: 23 Sep 2014, 13:31


Return to Support

Who is online

Users browsing this forum: No registered users and 3 guests

cron