commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Xianda Ke (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CRYPTO-89) more robust native code to eliminate memory leak
Date Thu, 23 Jun 2016 05:13:16 GMT

    [ https://issues.apache.org/jira/browse/CRYPTO-89?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15345754#comment-15345754
] 

Xianda Ke commented on CRYPTO-89:
---------------------------------

C doesn't support exceptions, try-finally blocks, or RAII at all. A typical approach is to
separate releasing of resources at the end of the function and jump there with gotos in the
case of error. This way the cleanup code need not be duplicated.

> more robust native code to eliminate memory leak
> ------------------------------------------------
>
>                 Key: CRYPTO-89
>                 URL: https://issues.apache.org/jira/browse/CRYPTO-89
>             Project: Commons Crypto
>          Issue Type: Bug
>            Reporter: Xianda Ke
>            Assignee: Xianda Ke
>
> currently, when handling error in the native code, some resource allocated is not deallocated.
> {code}
>     input_bytes = (unsigned char *) (*env)->GetByteArrayElements(env, input, 0); 
//in some case, it is not deallocated
> {code}
> the byte array may accupy lots of memory.  this can cause serious memory leak in the
long-running server



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message