On Sunday, October 28, 2012 6:26:28 AM UTC+8, Nobody wrote:
> On Sat, 27 Oct 2012 07:42:01 -0700, zlchen.ken wrote:
>
>
>
> > I have a DLL which written in C language, one of the function is to
>
> > allocate a structure, fill the members and then return the pointer of
>
> > the structure.
>
On Sat, 27 Oct 2012 07:42:01 -0700, zlchen.ken wrote:
> I have a DLL which written in C language, one of the function is to
> allocate a structure, fill the members and then return the pointer of
> the structure.
>
> After Python called this function, and done with the returned structure,
> I wo
On Sun, Oct 28, 2012 at 2:40 AM, Ken Chen wrote:
> Yes, I agree writing a corresponding API to free the memory is the best
> practice and best bet.
> Sometimes, the third party API may not provide that.
Then that's a majorly dangerous third party API. The only time it's
safe to provide a half-on
After I explicitly load the
msvcrt which built the DLL, things are getting function now.
"ctypes.util.find_msvcrt()
Windows only: return the filename of the VC runtype library used by Python, and
by the extension modules. If the name of the library cannot be determined, None
is returned.
On Sun, Oct 28, 2012 at 1:42 AM, wrote:
> Hi Guys,
>
> I have a DLL which written in C language, one of the function is to allocate
> a structure, fill the members and then return the pointer of the structure.
>
> After Python called this function, and done with the returned structure, I
> woul
Hi Guys,
I have a DLL which written in C language, one of the function is to allocate a
structure, fill the members and then return the pointer of the structure.
After Python called this function, and done with the returned structure, I
would like to free the returned structure. How can I achie
Tzury Bar Yochay gmail.com> writes:
>
> My question is how do I free the memory allocated when I call this
> function using ctypes
The return type of ctypes.create_string_buffer() will call free() when it is
garbage collected.
--
http://mail.python.org/mailman/listinfo/python-list
Hi,
Suppose I have the following function
char *generateMessage(char *sender, char *reciever, char *message) ;
now in c I would normally do
char *msg = generateMessage(sender, reciever, message);
// do something
free(msg);
My question is how do I free the memory allocated when I call this
funct
En Sun, 11 May 2008 01:06:13 -0300, Patrick Mullen <[EMAIL PROTECTED]> escribió:
> Yeah I don't know much about locals or globals. I've never used them
> before, just know they are there. But anyway, to illustrate what I meant by
> the interesting behavior, here is the output (and sorry for it b
Yeah I don't know much about locals or globals. I've never used them
before, just know they are there. But anyway, to illustrate what I meant by
the interesting behavior, here is the output (and sorry for it being so
long):
IDLE 2.6a2
>>> globals()
{'__builtins__': , '__name__': '__main__',
'__d
27;t understand you...
> It did have the effect that is asked for, although there may be more
> unintended consequences. Also if any objects are attached to any of the
> builtins I expect they will still be around.
Your code removes all direct references to objects from the current modu
I had some very interesting results with this code to do what is asked:
for key in globals().keys():
del globals()[key]
for key in locals().keys():
del locals()[key]
It might be better to reverse the two steps, I didn't give it much thought.
Anyway, when this is done, all of the builtins
Dark Wind schrieb:
> Hi,
>
> How can I free all the memory in python by deleting all variables. I am
> looking for the equivalent of 'clear' from Matlab.
>
> I know del x deletes a variable x, but it doesn't free all the available
> memory.
del doesn't free an object. It only removes one referen
On Thu, May 8, 2008 at 6:30 PM, Dark Wind <[EMAIL PROTECTED]> wrote:
> Hi,
>
> How can I free all the memory in python by deleting all variables. I am
> looking for the equivalent of 'clear' from Matlab.
>
> I know del x deletes a variable x, but it doesn't free all the available
> memory.
I don't
Hi,
How can I free all the memory in python by deleting all variables. I am
looking for the equivalent of 'clear' from Matlab.
I know del x deletes a variable x, but it doesn't free all the available
memory.
Thank you
--
http://mail.python.org/mailman/listinfo/python-list
Hi!
I've send the soft.
But, I have no news ; good news?
@+
Michel Claveau
--
http://mail.python.org/mailman/listinfo/python-list
Alex Martelli wrote:
> rfv-370 <[EMAIL PROTECTED]> wrote:
>
>> have made the following small test:
>>
>> Before starting my test my UsedPhysicalMemory(PF): 555Mb
>>
> tf=range(0,1000)PF: 710Mb ( so 155Mb for my List)
> tf=[0,1,2,3,4,5] PF: 672Mb (Why? Why the remaini
Alex Martelli a écrit :
> rfv-370 <[EMAIL PROTECTED]> wrote:
(snip)
>> So how can I force Python to clean the memory and free the memory that
>> is not used?
>
> On Windows, with Python 2.5, I don't know of a good approach (on Linux
> and other Unix-like systems I've used a strategy based on fork
On 8/27/07, Peter Otten <[EMAIL PROTECTED]> wrote:
> Peter Otten wrote:
>
> > Alex Martelli wrote:
> >
> >> Integer objects that are once generated are kept around in a "free list"
> >> against the probability that they might be needed again in the future (a
> >
> > Python 2.5.1 (r251:54863, May 2
Aïe!
gmail said : "illegal attachment" (because .exe?)
I will try to send a zipped-file...
@+
Michel Claveau
--
http://mail.python.org/mailman/listinfo/python-list
Re!
Sended by direct (private) e-mail
@+
Michel Claveau
--
http://mail.python.org/mailman/listinfo/python-list
Peter Otten wrote:
> Alex Martelli wrote:
>
>> Integer objects that are once generated are kept around in a "free list"
>> against the probability that they might be needed again in the future (a
>
> Python 2.5.1 (r251:54863, May 2 2007, 16:56:35)
> [GCC 4.1.2 (Ubuntu 4.1.2-0ubuntu4)] on linux2
Alex Martelli wrote:
> Integer objects that are once generated are kept around in a "free list"
> against the probability that they might be needed again in the future (a
Python 2.5.1 (r251:54863, May 2 2007, 16:56:35)
[GCC 4.1.2 (Ubuntu 4.1.2-0ubuntu4)] on linux2
Type "help", "copyright", "cred
ndard library is. And even a
`free()` in the C standard library doesn't guarantee that memory is given
back to the OS and reported as free memory again.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
Hi!
For windows, I had a soft for this (reduce_memory.exe). Sorry, it's not
write with Python.
If you want, I will give a URL for download it.
--
@-salutations
Michel Claveau
--
http://mail.python.org/mailman/listinfo/python-list
rfv-370 <[EMAIL PROTECTED]> wrote:
> have made the following small test:
>
> Before starting my test my UsedPhysicalMemory(PF): 555Mb
>
> >>>tf=range(0,1000)PF: 710Mb ( so 155Mb for my List)
> >>>tf=[0,1,2,3,4,5] PF: 672Mb (Why? Why the remaining 117Mb is
> >>>not freed?) del
have made the following small test:
Before starting my test my UsedPhysicalMemory(PF): 555Mb
>>>tf=range(0,1000)PF: 710Mb ( so 155Mb for my List)
>>> tf=[0,1,2,3,4,5] PF: 672Mb (Why? Why the remaining 117Mb is not
>>> freed?)
>>> del tfPF: 672Mb (u
On 2007-04-26, Martin v. Löwis <[EMAIL PROTECTED]> wrote:
>> I'm a bit fuzzy on this, but I don't think there _is_ a
>> practical way to "return memory to the OS" in many OSes.
>
> That's not true at all. Most C libraries these days manage
> to return memory to the operating system.
[...]
Thanks
[EMAIL PROTECTED] wrote:
> Our (python-)macro uses massively nested loops which are unfortunately
> necessary. These loops perform complex calculations in this commercial
> tool. To give you a quick overview how long this macros runs:
>
> The outer loop takes 5-7 hours for one cycle. Each cycle cr
> The moment I close the application that launched the macro, my
> ressources get freed.
>
> So is there a way to free my memory inside my nested loops?
Yes. Most likely, it is your algorithm itself which is flawed
(not Python, not the application that embeds Python): You keep,
most likely, refer
> I'm a bit fuzzy on this, but I don't think there _is_ a
> practical way to "return memory to the OS" in many OSes.
That's not true at all. Most C libraries these days manage
to return memory to the operating system.
On Win32 (which the OP is most likely to use), the
operating system offers the
"Diez B. Roggisch" <[EMAIL PROTECTED]> wrote:
> Maybe delegating the actual processing to an external python
> process you feed through the macro might work.
Thanks for the idea. I'll check it out soon and will report
about possible improvements.
--
http://mail.python.org/mailman/listinfo/pytho
You might try looking at references between objects, especially if
there are any cyclic refs. For instance, if you have a data structure
in which child nodes have back refs to their parents, try changing
these to use weakref's. This may help the garbage collector to better
reclaim discarded objec
Grant Edwards wrote:
> Assuming the python interpreter free()s the memory, my
> understanding is that on Unixes the memory is returned to the
> pool used by malloc(), but is not returned to the OS since
> there isn't a practical way to ensure that the memory at the
> "end" of the data segment is no
TimC schrieb:
> Donald 'Paddy' McCarthy <[EMAIL PROTECTED]> wrote
>
>> Could you split the program into one handling the outer loop and
>> calling another program, with data transfer, to handle the inner
>> loops?
>>
>> - Paddy.
>
> I'm afraid this isn't possible, because the python macro is call
Donald 'Paddy' McCarthy <[EMAIL PROTECTED]> wrote
> Could you split the program into one handling the outer loop and
> calling another program, with data transfer, to handle the inner
> loops?
>
> - Paddy.
I'm afraid this isn't possible, because the python macro is called
and started from within
In article <[EMAIL PROTECTED]>,
Steven Howe <[EMAIL PROTECTED]> wrote:
> Interesting questions. What happens when an object is 'cleaned' up by
> using the 'del' command. Does the memory space stay in the python
> process, get handed back to the OS, or some combination of both?
> I remember 'C' on
On 2007-04-25, Steven Howe <[EMAIL PROTECTED]> wrote:
>> I'm a bit fuzzy on this, but I don't think there _is_ a
>> practical way to "return memory to the OS" in many OSes. For
>> example in Unix the C library uses the sbrk() call to increase
>> the size of the data segment when additional memory
[EMAIL PROTECTED] wrote:
> So I read quite a few things about this phenomenon in Python 2.4.x but
> I can hardly believe that there is really no solution to my problem.
>
> We use a commercial tool that has a macro functionality. These macros
> are written in python. So far nothing extraordinary.
Grant Edwards wrote:
> On 2007-04-25, Chris Mellon <[EMAIL PROTECTED]> wrote:
>
>
>> "Returning memory to the OS" doesn't affect exhaustion of your virtual
>> address space. More likely, your nested loops are just creating more
>> objects than is possible to hold within a single process.
>>
On 2007-04-25, Chris Mellon <[EMAIL PROTECTED]> wrote:
> "Returning memory to the OS" doesn't affect exhaustion of your virtual
> address space. More likely, your nested loops are just creating more
> objects than is possible to hold within a single process.
I'm a bit fuzzy on this, but I don't t
On 25 Apr 2007 15:04:59 GMT, TimC <[EMAIL PROTECTED]> wrote:
> Larry Bates <[EMAIL PROTECTED]> wrote:
>
> > Let's see for this I need to get out my crystal ball...
> >
> > If it is a commercial application, you should contact their tech
> > support for a solution. The problem isn't specifically a
Larry Bates <[EMAIL PROTECTED]> wrote:
> Let's see for this I need to get out my crystal ball...
>
> If it is a commercial application, you should contact their tech
> support for a solution. The problem isn't specifically a Python
> problem but rather an implementation problem with their app.
>
[EMAIL PROTECTED] wrote:
> So I read quite a few things about this phenomenon in Python 2.4.x but
> I can hardly believe that there is really no solution to my problem.
>
> We use a commercial tool that has a macro functionality. These macros
> are written in python. So far nothing extraordinary.
Hi!
I got same problem with Lotus Domino + Python.
The lotus COM objects are not freed, so I get out from memory.
I solve this problem with a little trick:
I make two py applications. The first is call the second as like another
application.
The first is put some work to the seconds datadir.
Wh
So I read quite a few things about this phenomenon in Python 2.4.x but
I can hardly believe that there is really no solution to my problem.
We use a commercial tool that has a macro functionality. These macros
are written in python. So far nothing extraordinary.
Our (python-)macro uses massively
One other thing, I was reading about Py_DECREF...and I see it says
"A safe approach is to always use the generic operations (functions
whose name begins with "PyObject_", "PyNumber_", "PySequence_" or
"PyMapping_"). These operations always increment the reference count of
the object they return. T
I have been posting lately about writing a C wrapper so Python can
access my C functions.
In my wrapper function I have something like...
static PyObject *wrap_doStuff(PyObject *self, PyObject *args) {
PyObject *data;
char *result;
long *d;
PyArg_ParseTuple(args, "O:wrap_doStuff"
48 matches
Mail list logo