Re: Running out of memory on stack in C++ routine invoked within Cocoa NSOperation
Re: Running out of memory on stack in C++ routine invoked within Cocoa NSOperation
- Subject: Re: Running out of memory on stack in C++ routine invoked within Cocoa NSOperation
- From: Greg Parker <email@hidden>
- Date: Thu, 19 Feb 2009 12:00:17 -0800
On Feb 19, 2009, at 10:29 AM, Leo Singer wrote:
I would rather not dynamically allocate that particular array because
the Cocoa application I am developing is simply a wrapper for a cross
platform C++ project. This particular project has to manage a number
of different resources, including an SQLite database connection, an
open file, and a serial port device. In order to keep error handling
as simple as possible, I have made heavy use of the RIAA pattern. If
a serial port error occurs, for example, an exception gets thrown. As
a result, the objects representing both the database and the open file
go out of scope, and their resources are released.
It's not hard to write a wrapper object for the malloc() block that
calls free() when destructed. That would work just like your database
wrapper object and your file wrapper object.
--
Greg Parker email@hidden Runtime Wrangler
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden