So far, all of the memory our C++ code has allocated has either been global or on the stack. For the many times when the amount of memory isn’t known at compile time, we’ll need dynamic allocation. Today we’ll go over both the basics of new
and delete
, but also dive into some advanced C++ features such as overloading new
and “placement” new
.
Posts Tagged delete
Last week’s article covered delegates, so it’s only natural that we follow up this week by covering events. Supporting delegates has laid a good foundation for supporting events, so let’s dive in and see how to implement and use them in C++.
The Flash API has a gem of a class in Proxy. You can use it to customize the behavior of the dot (.
), index ([]
), delete
, and in
operators as well as the for-in
and for-each-in
loops. Today’s article answers a recent comment by exploring the performance implications of all this fancy customizing that Proxy
allows.
During some recent memory profiling I was reacquainted with just how many ways there are to unknowingly allocate an object in AS3. The problem is seldom the allocation itself, but rather the later garbage collection (GC) to delete those objects. Ever used a Flash profiler only to see a huge chunk of your CPU time going to [reap]
, [mark]
, or [sweep]
? Yeah, that’s the GC at work. Today’s article talks about some of the ways you end up allocating objects in AS3 without using the new
keyword. These subtle errors can end up costing you!
Today’s article is in response to some interesting comments on the previous article comparing Array‘s performance to that of Vector. Today I’ll test different types of Vectors and the performance of deleting elements.