[Midnight Commander] #125: allocate and free memory via mc-wrappers
- From: "Ticket System" <tickets midnight-commander org>
- To: slavazanko gmail com
- Cc: mc-devel gnome org
- Subject: [Midnight Commander] #125: allocate and free memory via mc-wrappers
- Date: Sat, 03 Jan 2009 15:15:05 -0000
#125: allocate and free memory via mc-wrappers
-------------------------+--------------------------------------------------
Reporter: slavazanko | Owner:
Type: enhancement | Status: new
Priority: major | Milestone: 4.6.2
Component: mc-core | Version: 4.6.1
Keywords: memory | Blocking:
Blockedby: |
-------------------------+--------------------------------------------------
Now in sources mixed many technologies for working with memory:
- system functions (malloc/free)
- glib functions (g_malloc/g_free)
- self-made function (like in vfs/mcserv.c:127)
This patch is a first attempt to reorganize work with memory - only
replace malloc with mc_malloc; g_malloc with mc_malloc, [g_]free with
mc_free, etc.
All definitions of mc_<malloc|free|calloc|...> placed in src/glibcompat.h.
This not good place, I understand. Next step - create 'src/mc-alloc.[ch]'.
This must be place of definitions memory-related functions; code from
src/poptalloca.h and src/regex.c (related to definition of 'alloca' ) must
will moved to mc-alloc module too.
As fact, this patch is a refactoring of sources. I'm don't create mc-alloc
at this time, because refactoring should made by little steps. This first
step is prepare stage :)
Advantages:
1) We can will realize garbage collector or debugger of memory leaks;
2) We can will realize own library 'mcglib' - for embedded systems it's
very good;
3) In sources used only one technology of working with memory: mc-alloc
(in future). And only in mc-alloc will use much different technologies;
4) More order in mind. :)
Disadvantages:
1) All existing patches will need to hand processing... in many case.
Because this patch will change a lot of files and applying patches via
'patch' or 'git-apply' command may will fail
P.S. patch is too big and attached as gz-archive (because limit to size of
attaches).
--
Ticket URL: <http://midnight-commander.org/ticket/125>
Midnight Commander <www.midnight-commander.org>
Midnight Development Center
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]