bug-recutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-recutils] Python support


From: Maninya M
Subject: Re: [bug-recutils] Python support
Date: Mon, 29 Jul 2013 18:47:47 +0530

Hi, 
Thanks for your response. I have been working on some of the tasks above. However, I have been stuck with a double memory free problem for a few days. I think it is a bug in recutils. There seems to be a memory leak in rec_parse_db(). Please see the attached C program. I have used a function myfunc() to parse a rec file into a DB, print its size and then free everything. It runs this function myfunc() in an infinite loop. I used the top command to observe resident (RES) memory during run. It keeps increasing. Could you please check and let me know if this is a real problem, or I am probably missing something? Thanks.    


On 24 July 2013 00:31, Michał Masłowski <address@hidden> wrote:
Hi.

> a) The duplicate functions.

Librec doesn't use reference counting: all objects inside other objects
are deep copied.  This makes duplicating objects more useful than in
Python where references are typically used.  Maybe implement the special
methods used by the copy module instead?  (I haven't tried to understand
how Recutils and Python memory management would cooperate.)

> b) Functions that get/set elements, msets (I think we don't need to
> expose msets).

We need some way of iterating records and comments, msets with list-like
interface could do this.  Making custom element types doesn't look
useful outside of librec, so it could be omitted.

> c) Comment functions.

These work just as strings, so the APIs using them could accept Python
strings and translate them into rec_comment_t.

> d) Integrity checks, for a database alone is enough?

Being able to use them would make writing Python scripts modifying
recfiles easier.

> e) Encryption routines for field and record.
> f) Aggregate functions.

Maybe these could be implemented later, they don't seem to affect the
design much.  Implementing aggregate functions in Python could be
useful, while it should be easy to do similar processing of query
results in Python scripts instead.

> It may be better if you could tell me what functions/functionality are
> *absolutely* necessary in Python. I will modify accordingly. Thanks.

Maybe write a specific script using these bindings?  It could be simpler
than finding a necessary minimum functionality.

I have some uses for readonly processing of recfiles, being able to
iterate over all rsets and records of a recfile should be sufficient for
it.  Reimplementing one of the utils would show what functionality might
be useful, I think it would be too much to implement now (although
rec2csv looks simple and Python has its own csv module).



--
Maninya

Attachment: sample.c
Description: Text Data

Attachment: books.rec
Description: Binary data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]