473,774 Members | 2,248 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Custom memory manager

Hello all. If I want to use a custom memory manager to, say, track memory
allocations in Python, what's the best way to do this? I seem to remember
there being a way in version 1.5 (or so -- been a while since I used it). I
didn't see anything in the documentation, but I may have missed it.

I've got the Python source code (v2.3.3) embedded in my application (which is
in C++), and would like to somehow override Python's default memory
allocators. Is there an easy or "accepted" way to do this?

Thanks!

Carl

--
Remove "NOSPAM" to reply in e-mail

Jul 18 '05 #1
1 1864

We have done some experiments with the memory manager in Python 2.3+.
Not to replace it but to obtain more detailed and accurate statistics
for the memory usage.

One thing to keep in in mind is that not all memory in a Python
application is managed by the Python memory manager. Objects may be
allocated by direct calls to malloc() and then passed to the Python
memory manager to be freed. The Python memory manager handles that
scenario properly.

While replacing the Python manager is possible, be prepared for some
surprises. It all depends on the actual modules used in your Python
application and how those modules allocate objects.

/Jean Brouwers
ProphICy Semiconductor, Inc.

In article <aO************ ********@speake asy.net>, Carl Bevil
<ca************ **@yahoo.com> wrote:
Hello all. If I want to use a custom memory manager to, say, track memory
allocations in Python, what's the best way to do this? I seem to remember
there being a way in version 1.5 (or so -- been a while since I used it). I
didn't see anything in the documentation, but I may have missed it.

I've got the Python source code (v2.3.3) embedded in my application (which is
in C++), and would like to somehow override Python's default memory
allocators. Is there an easy or "accepted" way to do this?

Thanks!

Carl

--
Remove "NOSPAM" to reply in e-mail

Jul 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

18
6680
by: Tron Thomas | last post by:
Given the following information about memory management in C++: ----- The c-runtime dynamic memory manager (and most other commercial memory managers) has issues with fragmentation similar to a hard drive file system. Over time, the more often use call new/delete or alloc/free, there will be gaps and fragments in the heap. This can lead to inefficient use of available memory, as well as cache-hit inefficiencies.
7
1630
by: Casey Leamon | last post by:
I've been noticing that all of my .NET apps seem to progressivly use more and more memory. Even after several reworks of the code I can only manage to slow the growth. Is there some Garbage Collection caveat that's holding old data into higher generations accidentlly? Has anyone else noticed this?
5
2609
by: Martin Bischoff | last post by:
Hi, is it possible to implement custom resource managers for ASP.NET 2.0 so that strings can be read from a database (for example)? Ideally, it should be possible to configure the custom resource manager in web.config, so that it replaces the default resource manager. Using the <%$ ... %> syntax should read the strings via the custom resource manager, e.g. when used like this:
4
2947
by: Robert Frunzke | last post by:
Hello, I need to implement a custom allocator to speed up the allocation of a specific class in my project and instead of hardwiring it, I would "templatize"(?) it. The allocator should have minimal overhead and be used for allocation of a large number of "Node" classes which represent a hierarchical structure. The custom allocator has to be at least intrusive as possible for the user. The allocator has to be somehow bound to the...
0
1397
by: onyxring | last post by:
I'm reposting this, because I had a bit of difficulty last time and think that it might have fallen through the cracks. If I'm posting to the wrong groups, please let me know. Surely someone has some experience with this... I've been building custom web controls in C# with VS2005. Currently I'm looking into adding design-time functionality and have reached a point where I need to generate code in the page the custom control is on. ...
0
1176
by: onyxring | last post by:
I've been building custom web controls in C# with VS2005. Currently I'm looking into adding design-time functionality and have reached a point where I need to generate code in the page the custom control is on. Enter the CodeDomSerializer class. I've found several examples creating Designer Serializers, nearly all of them for windows forms, but a few claiming to work for Web Controls; however, I have been singularly unsuccessful at...
6
2135
by: Dave Rahardja | last post by:
I need to design a container that must hold a set of references to a variety of object types, managed by different memory managers. At some time, the container must destroy each object. Currently I have the following design in mind: class Destructible // interface { public: virtual void destroy() = 0;
6
3310
by: 2wycked | last post by:
Hello all, I'm trying to make a custom memory manager using classes. At this point, I'm not trying to make it paticularly portable, just get something running for my system. Yes I know there are tons of other customs managers out there, but this is for my own personal development as a programmer. My main problem I'm having right now is initializing a global heap. The class system is based on ADT's that allow for custom heaps, but I'm...
5
4127
by: gerry | last post by:
I am trying to create a custom container control that will only ever contain a specific type of control. At design time, when a control of a different type is added to the container I would like to wrap the control in the proper control type - which is also a container. At design time I want to be able to turn this : <my:container> <asp:textbox />
0
9454
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10267
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10106
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10040
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9914
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8939
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6717
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
3611
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2852
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.