question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

The caller object eats much memory

See original GitHub issue

Hi I’d like to explore all paths of a give fuction, so I choose the caller object. The tested code is a simple bubble sort, shown as follows.

#define BUFF_LEN 6
void bubble_sort(char *buff)
{
  for(int i = 0; i < BUFF_LEN - 1; i++)
    for(int j = i + 1; j < BUFF_LEN; j++)
    {
       if(buff[i] > buff[j])
       { 
         int tmp = buff[i];
         buff[i] = buff[j];
         buff[j] = tmp;
       }
    }
}

Then length of buffis 6, so I suppose there would be thousands of paths at most. Below is my testing script.

import angr
b = angr.Project("path_explosion")
cfg = b.analyses.CFGAccurate()
target_func = cfg.kb.functions.function(name='bubble_sort')
print target_func
p = b.factory.path()
x = p.state.memory.load(0x1000, 6)
c = b.surveyors.Caller(0x400566, (0x1000, ), start=p)#0x400566 is the entry of bubble_sort 
print tuple(c.iter_returns())
print c

I installed Angr in a virtual machine. Before running the testing script, 4.1GB physical memory are cost (8GB in total). The memory consumption increases to 8GB in a few seconds, after I launch the script. After a few minutes, Angr cashes due to memory exhaustion (may be).

Then I change the length of buffinto a little bit smaller value, that is 5. Angr gives me result in about 3 minutes as follows (I omitted detailed information of all founded paths for brief). <Explorer with paths: 0 active, 0 spilled, 798 deadended, 0 errored, 0 unconstrained, 226 found, 0 avoided, 0 deviating, 0 looping, 0 lost>

I suppose that the caller object may eat much memory if there are many paths (thousands?) should be explored.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:11 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
zarduscommented, May 11, 2016

lol. For testing purposes, you can also spin up some pretty beefy instances on AWS. But I’d also check out veritesting. It can be used by passing enable_veritesting=True to the PathGroup creation.

1reaction
zarduscommented, May 11, 2016

I think it’s also important to note that there’s a middle ground between “symbolic execution is the panacea of program analysis” and “symbolic execution is useless”. One of the approaches that @rhelmot talks about in the 32C3 talk is Veritesting (see: https://users.ece.cmu.edu/~aavgerin/papers/veritesting-icse-2014.pdf). angr includes an implementation of this, and it might actually help in this case.

In general, though, 8 gigs is very little memory. IMO, 32 gigs is too little for reasonable programs. My workstation for angr, for example, has 128 gigs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What is the memory consumption of an object in Java?
Take a look at my answer for Integer example. Overhead of object is at least 12 bytes for header for 64-bit system and...
Read more >
Javascript Objects and Memory Consumption | 7Factor Software
This article described how different patterns could consume more memory than others, and after reading it I wanted to build something to ...
Read more >
Manage your app's memory - Android Developers
See how your app allocates memory over time. The Memory Profiler shows a realtime graph of how much memory your app is using,...
Read more >
Do classes or objects use more memory when it has functions ...
If a class has any virtual functions, it will take up more room than a class with no virtual functions. Typically each instance...
Read more >
Detect and diagnose memory issues - WWDC21 - Videos
Discover how you can understand and diagnose memory performance problems with Xcode. We'll take you through the latest updates to Xcode's...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found