X

NV5 Geospatial Blog

Each month, NV5 Geospatial posts new blog content across a variety of categories. Browse our latest posts below to learn about important geospatial information or use the search bar to find a specific topic or author. Stay informed of the latest blog posts, events, and technologies by joining our email list!



Comparing Amplitude and Coherence Time Series With ICEYE US GTR Data and ENVI SARscape

Comparing Amplitude and Coherence Time Series With ICEYE US GTR Data and ENVI SARscape

12/3/2025

Large commercial SAR satellite constellations have opened a new era for persistent Earth monitoring, giving analysts the ability to move beyond simple two-image comparisons into robust time series analysis. By acquiring SAR data with near-identical geometry every 24 hours, Ground Track Repeat (GTR) missions minimize geometric decorrelation,... Read More >

Empowering D&I Analysts to Maximize the Value of SAR

Empowering D&I Analysts to Maximize the Value of SAR

12/1/2025

Defense and intelligence (D&I) analysts rely on high-resolution imagery with frequent revisit times to effectively monitor operational areas. While optical imagery is valuable, it faces limitations from cloud cover, smoke, and in some cases, infrequent revisit times. These challenges can hinder timely and accurate data collection and... Read More >

Easily Share Workflows With the Analytics Repository

Easily Share Workflows With the Analytics Repository

10/27/2025

With the recent release of ENVI® 6.2 and the Analytics Repository, it’s now easier than ever to create and share image processing workflows across your organization. With that in mind, we wrote this blog to: Introduce the Analytics Repository Describe how you can use ENVI’s interactive workflows to... Read More >

Deploy, Share, Repeat: AI Meets the Analytics Repository

Deploy, Share, Repeat: AI Meets the Analytics Repository

10/13/2025

The upcoming release of ENVI® Deep Learning 4.0 makes it easier than ever to import, deploy, and share AI models, including industry-standard ONNX models, using the integrated Analytics Repository. Whether you're building deep learning models in PyTorch, TensorFlow, or using ENVI’s native model creation tools, ENVI... Read More >

Blazing a trail: SaraniaSat-led Team Shapes the Future of Space-Based Analytics

Blazing a trail: SaraniaSat-led Team Shapes the Future of Space-Based Analytics

10/13/2025

On July 24, 2025, a unique international partnership of SaraniaSat, NV5 Geospatial Software, BruhnBruhn Innovation (BBI), Netnod, and Hewlett Packard Enterprise (HPE) achieved something unprecedented: a true demonstration of cloud-native computing onboard the International Space Station (ISS) (Fig. 1). Figure 1. Hewlett... Read More >

1345678910Last
12194 Rate this article:
No rating

What the *bleep* is IDL doing? Garbage collection

Anonym

In 8.0, automatic garbage collection was introduced to the IDL language. What it brought was some much needed relief in controlling the memory used by IDL.  Pre IDL 8.0, if you ran:

obj = obj_new('MyIDLObject')

obj = obj_new('MyOtherIDLObject')

Then the first instance of obj was "leaked", meaning the memory could no longer be accessed by IDL and would be inaccessible until IDL was restarted. This is especially bad in large applications where "leaked" memory would slowly consume all the resources of the machine. With the addition of garbage collection, as soon as the second call happens, the first object is freed and the memory it used is released back to IDL. So in IDL 8.4:

IDL> o = obj_new('MyIDLObject') & help,/heap,/brief

Heap Variables:

    # Pointer: 0

    # Object : 1

    # Bytes Heap Memory:  24

IDL> o = obj_new('MyOtherIDLObject') & help,/heap,/brief

Heap Variables:

    # Pointer: 0

    # Object : 1

    # Bytes Heap Memory:  24

However, consider the following example:

        p = plot(/test)

        p = plot(randomu(seed,100))

If you run these statements, both plot windows will stay open even though it seems like IDL's garbage collection should have freed the first instance of p. The reason IDL doesn't free the first instance of p is because of something called reference counting. In order to perform garbage collection, IDL needs to know when the user can no longer reference an object. So if you run:

a = obj_new('MyIDLObject')

b =  a

help,/heap

IDL prints:

Heap Variables:

    # Pointer: 0

    # Object : 1

<ObjHeapVar2>  refcount=2

                STRUCT    = -> MYIDLOBJECT Array[1]

 

The refcount field tells you how many IDL variables are pointing to the same object.  As soon as the refcount becomes 0, IDL's garbage collection will free the object.

Side Note: Be very careful using the OBJ_DESTROY method.  If I call OBJ_DESTROY on b, a will no longer be a valid object.  If you want to free an unnecessary reference to an object, set the variable to either !NULL or 0 to avoid destroying the object for all other references.

Let's get back to the PLOT example. In this case, IDL is holding the refcount above zero since the window is still open. Until you close the window, the plot will stay alive. You may be asking yourself, "well if IDL has the window, how do I get a reference back to it because I really didn't mean to lose my previous reference". Here is where GETWINDOWS() and WINDOW(/current) shine. Let's say you ran the following code:

p = plot(/test)

p = plot(randomu(seed,100))

Oops, we didn't want to lose a reference to the first plot object!  To get that reference back: first, click on the window then run:

w = WINDOW(/current)

Then select the plot inside the window and run:

p1 = w.getselect()

help, p1

P1         PLOT <5168>

The first line snags a reference of the active window. The second line grabs a reference to the plot. Similarly, you can grab a reference to the plot without having to click anything by using GETWINDOWS():

pwin = GETWINDOWS()

Will return an array of references to all active plot windows in the order they were created. By indexing into the desired window, we can grab a reference to the plot by:

tool = pwin[0].gettool()

id = igetid('plot',tool=tool)

obj = tool->getbyidentifier(id)

obj->idlitcomponent::getproperty, _proxy=p1

help, p1

P1         PLOT <5168>

By understanding the lifecycle of IDL objects, you can better manage the memory IDL uses as well as retrieve objects you might have thought were lost.

Please login or register to post comments.