skip to main content
research-article

Analyzing memory ownership patterns in C libraries

Authors Info & Claims
Published:20 June 2013Publication History
Skip Abstract Section

Abstract

Programs written in multiple languages are known as polyglot programs. In part due to the proliferation of new and productive high-level programming languages, these programs are becoming more common in environments that must interoperate with existing systems. Polyglot programs must manage resource lifetimes across language boundaries. Resource lifetime management bugs can lead to leaks and crashes, which are more difficult to debug in polyglot programs than monoglot programs.

We present analyses to automatically infer the ownership semantics of C libraries. The results of these analyses can be used to generate bindings to C libraries that intelligently manage resources, to check the correctness of polyglot programs, and to document the interfaces of C libraries. While these analyses are unsound and incomplete, we demonstrate that they significantly reduce the manual annotation burden for a suite of fifteen open source libraries.

References

  1. C. Boyapati, B. Liskov, and L. Shrira. Ownership types for object encapsulation. In A. Aiken and G. Morrisett, editors, POPL, pages 213--223. ACM, 2003. ISBN 1-58113-628-5. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. B.-C. Cheng and W. W. Hwu. Modular interprocedural pointer analysis using access paths: design, implementation, and evaluation. In M. S. Lam, editor, PLDI, pages 57--69. ACM, 2000. ISBN 1-58113-199-2. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. J.-D. Choi, M. Gupta, M. J. Serrano, V. C. Sreedhar, and S. P. Midkiff. Stack allocation and synchronization optimizations for Java using escape analysis. ACM Trans. Program. Lang. Syst., 25 (6): 876--910, 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. M. Emmi, R. Jhala, E. Kohler, and R. Majumdar. Verifying reference counting implementations. In S. Kowalewski and A. Philippou, editors, TACAS, volume 5505 of Lecture Notes in Computer Science, pages 352--367. Springer, 2009. ISBN 978-3-642-00767-5. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. R. P. Gabriel, D. F. Bacon, C. V. Lopes, and G. L. S. Jr., editors. Proceedings of the 22nd Annual ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications, OOPSLA 2007, October 21-25, 2007, Montreal, Quebec, Canada, 2007. ACM. ISBN 978-1-59593-786-5. Google ScholarGoogle Scholar
  6. D. L. Heine and M. S. Lam. A practical flow-sensitive and contextsensitive C and C++ memory leak detector. In PLDI, pages 168--181. ACM, 2003. ISBN 1-58113-662-5. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. U. P. Khedker, A. Sanyal, and A. Karkare. Heap reference analysis using access graphs. ACM Trans. Program. Lang. Syst., 30 (1), 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. C. Lattner and V. S. Adve. LLVM: A compilation framework for lifelong program analysis & transformation. In CGO, pages 75--88. IEEE Computer Society, 2004. ISBN 0-7695-2102-9. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. L. Li, C. Cifuentes, and N. Keynes. Boosting the performance of flow-sensitive points-to analysis using value flow. In T. Gyimóthy and A. Zeller, editors, SIGSOFT FSE, pages 343--353. ACM, 2011. ISBN 978-1-4503-0443--6. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. K.-K. Ma and J. S. Foster. Inferring aliasing and encapsulation properties for Java. IncitetDBLP:conf/oopsla/2007, pages 423--440. ISBN 978-1-59593-786-5. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. I. Matosevic and T. S. Abdelrahman. Efficient bottom-up heap analysis for symbolic path-based data access summaries. In C. Eidt, A. M. Holler, U. Srinivasan, and S. P. Amarasinghe, editors, CGO, pages 252--263. ACM, 2012. ISBN 978-1-4503-1206-6. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. P. Müller and A. Rudich. Ownership transfer in universe types. IncitetDBLP:conf/oopsla/2007, pages 461--478. ISBN 978-1-59593-786-5. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. S. Negara, R. K. Karmani, and G. A. Agha. Inferring ownership transfer for efficient message passing. In C. Cascaval and P.-C. Yew, editors, PPOPP, pages 81--90. ACM, 2011. ISBN 978-1-4503-0119-0. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. T. E. Oliphant. Python for scientific computing. Computing in Science and Engineering, 9 (3): 10--20, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. D. J. Pearce, P. H. J. Kelly, and C. Hankin. Efficient field-sensitive pointer analysis of c. ACM Trans. Program. Lang. Syst., 30 (1), 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. T. Ravitch, S. Jackson, E. Aderhold, and B. Liblit. Automatic Generation of Library Bindings using Static Analysis. In M. Hind and A. Diwan, editors, PLDI, pages 352--362. ACM, 2009. ISBN 978-1-60558-392-1. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. D. Rayside and L. Mendel. Object ownership profiling: a technique for finding and fixing memory leaks. In R. E. K. Stirewalt, A. Egyed, and B. Fischer, editors, ASE, pages 194--203. ACM, 2007. ISBN 978-1-59593-882-4. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. S. Sagiv, T. W. Reps, and R. Wilhelm. Parametric shape analysis via 3-valued logic. ACM Trans. Program. Lang. Syst., 24 (3): 217--298, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. A. Salcianu and M. C. Rinard. Pointer and escape analysis for multithreaded programs. In M. T. Heath and A. Lumsdaine, editors, PPOPP, pages 12--23. ACM, 2001. ISBN 1-5811--346-4. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. M. Wegiel and C. Krintz. Cross-language, Type-safe, and Transparent Object Sharing for co-Located Managed Runtimes. In W. R. Cook, S. Clarke, and M. C. Rinard, editors, OOPSLA, pages 223--240. ACM, 2010. ISBN 978-1-4503-0203-6. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. J. Whaley and M. C. Rinard. Compositional pointer and escape analysis for Java programs. In B. Hailpern, L. M. Northrop, and A. M. Berman, editors, OOPSLA, pages 187--206. ACM, 1999. ISBN 1-58113-238-7. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Analyzing memory ownership patterns in C libraries

              Recommendations

              Comments

              Login options

              Check if you have access through your login credentials or your institution to get full access on this article.

              Sign in

              Full Access

              PDF Format

              View or Download as a PDF file.

              PDF

              eReader

              View online with eReader.

              eReader
              About Cookies On This Site

              We use cookies to ensure that we give you the best experience on our website.

              Learn more

              Got it!