[lvm-devel] [PATCH 0/2] Change lvm2app memory allocation for pv/vg/lv properties

Dave Wysochanski dwysocha at redhat.com
Wed Apr 14 15:20:57 UTC 2010


This patchset changes memory allocation for pv/vg/lv properties in lvm2app.
Unfortunately, this is a change to the existing API, but has the following
benefits:
1) gives us consistency in memory handling across the API (lvm2app
allocs/frees memory for strings and lists).
2) allows for simpler application code

A few downsides of this approach:
1) an application that repeatedly calls a 'get' property function will
generate repeated allocations and could eventually trigger an OOM,
as the only way to release memory is to release the vg handle.  Possible
fixes to this situation include the application release and reacquire
the vg handle, or lvm2app provide another API to release object property
memory tied to a vg handle (internally this would require a separate
memory pool for the attribute memory).  In any case, there are workarounds
possible for this downside.
2) An application may hold a vg handle open longer than it would previously.
This would mean an application would hold a lock longer than it might have
had lvm2app given the application control of the memory.  This is really
an application issue though, since the application can simply copy memory
properties it might need and release the vg handle.




More information about the lvm-devel mailing list